Sha256: 194f176e788952652b6d69c953dc98d099acb0d88694c4f993ca4cb99f2077d5

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery
  before_filter :set_current_user
  helper_method :current_user
  before_filter :set_locale

  def current_user
    session[:user_id] ? User.find(session[:user_id]) : User.first
  end

  def set_current_user
    session[:user_id] = User.first
  end

  def toggle_edition_mode
    Interpret.live_edit = !Interpret.live_edit

    redirect_to :back
  end

  def set_locale
    I18n.locale = params[:locale] || I18n.default_locale
  end

  def default_url_options(options = {})
    options.merge({:locale => I18n.locale})
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
interpret-1.1.2 test_app/app/controllers/application_controller.rb
interpret-1.1.1 test_app/app/controllers/application_controller.rb
interpret-1.1.0 test_app/app/controllers/application_controller.rb