2014-07-28 12:34:18 +03:00
|
|
|
class ApplicationController < ActionController::Base
|
|
|
|
# Prevent CSRF attacks by raising an exception.
|
|
|
|
# For APIs, you may want to use :null_session instead.
|
|
|
|
protect_from_forgery with: :exception
|
2014-08-31 14:57:34 +03:00
|
|
|
before_filter :configure_permitted_parameters, if: :devise_controller?
|
2014-09-01 12:32:03 +03:00
|
|
|
before_action :set_locale
|
|
|
|
|
2014-09-01 23:48:55 +03:00
|
|
|
def self.default_url_options(options={})
|
|
|
|
if I18n.locale != I18n.default_locale
|
|
|
|
options.merge({locale: I18n.locale})
|
2014-09-01 12:56:33 +03:00
|
|
|
else
|
2014-09-01 23:48:55 +03:00
|
|
|
options
|
2014-09-01 12:56:33 +03:00
|
|
|
end
|
2014-09-01 12:32:03 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_locale
|
|
|
|
I18n.locale = params[:locale] || I18n.default_locale
|
|
|
|
end
|
2014-08-31 14:57:34 +03:00
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def configure_permitted_parameters
|
|
|
|
devise_parameter_sanitizer.for(:account_update) do |u|
|
2014-08-31 16:02:56 +03:00
|
|
|
u.permit(:email, :password, :password_confirmation, :current_password, speaker_profile_attributes: [:first_name, :last_name, :public_email, :organisation, :github, :twitter, :mobile_phone, :biography, :picture, :id])
|
2014-08-31 14:57:34 +03:00
|
|
|
end
|
|
|
|
end
|
2014-07-28 12:34:18 +03:00
|
|
|
end
|