Class: Spree::CurrencyController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/currency_controller.rb

Instance Method Summary collapse

Instance Method Details

#setObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/spree/currency_controller.rb', line 6

def set
  char_code = params[:id].to_s.upcase
  @currency = Spree::Currency.find_by_char_code(char_code)
  if @currency
    session[:currency_id] = char_code.to_sym
    Spree::Currency.current!(@currency)
    flash.notice = t(:currency_changed)
  else
    flash[:error] = t(:currency_not_found)
  end

  redirect_back_or_default(root_path)
end