Module: Distribuo::Respond
- Included in:
- ApplicationAdminController
- Defined in:
- app/controllers/concerns/distribuo/respond.rb
Instance Method Summary collapse
-
#respond(result, options = {}) ⇒ Object
Informs the user and redirects when needed.
Instance Method Details
#respond(result, options = {}) ⇒ Object
Informs the user and redirects when needed
There is also a list of options that could be used along with validators:
-
:path- Specifies where to redirect to in case of success -
:notice- What to show on success -
:error- What to show on error -
:action- What action to render -
:error_action- What action to render in case of failure -
:model- What model to use for auto-generated notice/error flashes
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/concerns/distribuo/respond.rb', line 19 def respond(result, = {}) [:action] ||= :index [:error_action] ||= :edit [:continue_action] ||= [:error_action] respond_flash(result, ) if respond_redirect?(result) respond_redirect(result, ) else render result ? [:continue_action] : [:error_action] end end |