Module: I18nRailsHelpers::ControllerHelpers
- Defined in:
- lib/i18n_rails_helpers/controller_helpers.rb
Instance Method Summary collapse
-
#redirect_notice(record = nil) ⇒ Object
returns a redirect notice for create, update and destroy actions.
Instance Method Details
#redirect_notice(record = nil) ⇒ Object
returns a redirect notice for create, update and destroy actions
Example in ClientsController:
redirect_to some_path, redirect_notice # => 'Klient geändert.'
redirect_to some_path, redirect_notice(@client) # => 'Klient Example Client geändert.'
12 13 14 15 |
# File 'lib/i18n_rails_helpers/controller_helpers.rb', line 12 def redirect_notice(record = nil) { notice: I18n.t("crud.notices.#{action_name}", model: helpers.t_model, record: record.present? ? "#{record} " : '') } end |