Class: SweetActions::JSON::BaseAction
- Includes:
- Serialize
- Defined in:
- lib/sweet_actions/json/base_action.rb
Direct Known Subclasses
CollectAction, CreateAction, DestroyAction, ShowAction, UpdateAction
Instance Attribute Summary collapse
-
#response_code ⇒ Object
readonly
Returns the value of attribute response_code.
-
#response_data ⇒ Object
readonly
Returns the value of attribute response_data.
Attributes inherited from Action
Instance Method Summary collapse
Methods inherited from Action
Constructor Details
This class inherits a constructor from SweetActions::Action
Instance Attribute Details
#response_code ⇒ Object (readonly)
Returns the value of attribute response_code.
6 7 8 |
# File 'lib/sweet_actions/json/base_action.rb', line 6 def response_code @response_code end |
#response_data ⇒ Object (readonly)
Returns the value of attribute response_data.
6 7 8 |
# File 'lib/sweet_actions/json/base_action.rb', line 6 def response_data @response_data end |
Instance Method Details
#perform_action ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/sweet_actions/json/base_action.rb', line 8 def perform_action run_action = Proc.new do before_action @response_data = action end debug_mode? ? run_action.call : fail_gracefully(run_action) controller.render status: response_code, json: response_data end |