cirandas.net

ref: master

plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class ShoppingCartPluginMyprofileController < MyProfileController

  helper DeliveryPlugin::DisplayHelper

  def edit
    params[:settings] = treat_cart_options(params[:settings])
    @settings = profile.shopping_cart_settings params[:settings] || {}
    if request.post?
      @success = @settings.save!
    end
  end

  protected

  def treat_cart_options(settings)
    return if settings.blank?
    settings[:enabled] = settings[:enabled] == '1'
    settings
  end

end