Module: Glib::Json::Libs::ClassMethods
- Defined in:
- app/controllers/concerns/glib/json/libs.rb
Instance Method Summary collapse
- #json_libs_force_json_ui ⇒ Object
- #json_libs_init(options) ⇒ Object
- #json_libs_rescue_csrf ⇒ Object
- #json_libs_set_locale ⇒ Object
Instance Method Details
#json_libs_force_json_ui ⇒ Object
83 84 85 |
# File 'app/controllers/concerns/glib/json/libs.rb', line 83 def json_libs_force_json_ui before_action :json_libs_force_json_ui end |
#json_libs_init(options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/concerns/glib/json/libs.rb', line 53 def json_libs_init() include Glib::Json::Transformation include Glib::Json::Validation include Glib::Json::Ui include Glib::Json::Traversal include Glib::Json::NewDynamicText before_action :__json_ui_start # Note that after_action gets executed in reverse after_action do __json_ui_commit() end after_action :__json_transformation_commit after_action :__json_validate_perform after_action :__json_traversal_perform after_action :__json_traversal_register_dynamic_text end |
#json_libs_rescue_csrf ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'app/controllers/concerns/glib/json/libs.rb', line 87 def json_libs_rescue_csrf rescue_from ActionController::InvalidAuthenticityToken do |exception| sign_out(:user) respond_to do |format| format.json do render json: { onResponse: { action: 'windows/open-v1', url: root_url } } end end end end |
#json_libs_set_locale ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'app/controllers/concerns/glib/json/libs.rb', line 74 def json_libs_set_locale before_action do # Need to explicitly fallback to EN I18n.locale = params[:_locale] || :en rescue I18n.locale = :en end end |