A website template with lots of features, built with ruby on rails.

application_controller.rb 755B

12345678910111213141516171819202122
  1. class ApplicationController < ActionController::Base
  2. # Prevent CSRF attacks by raising an exception.
  3. # For APIs, you may want to use :null_session instead.
  4. protect_from_forgery with: :exception
  5. before_filter :config_site
  6. before_filter :configure_permitted_parameters, if: :devise_controller?
  7. def configure_permitted_parameters
  8. devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:first_name, :last_name, :email, :current_password, :avatar) }
  9. devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :last_name, :email, :password) }
  10. end
  11. def config_site
  12. @config = Info.first
  13. #I18n.config.enforce_available_locales = false
  14. I18n.default_locale = @config.default_language
  15. end
  16. end