app/controllers/alchemy/admin/base_controller.rb
# Displays errors in a #errors div if any errors are present on the object.
# Or redirects to the given redirect url.
#
# @param object [ActiveRecord::Base]
# @param redirect_url [String]
# @param flash_notice [String]
#
Displays errors in a #errors div if any errors are present on the object.
Or redirects to the given redirect url.
Displays errors in a #errors div if any errors are present on the object . Or redirects to the given redirect url .
def render_errors_or_redirect(object, redirect_url, flash_notice)
        if object.errors.empty?
          flash[:notice] = Alchemy.t(flash_notice)
          do_redirect_to redirect_url
        else
          render action: (params[:action] == 'update' ? 'edit' : 'new')
        end
      end
def render_errors_or_redirect ( object , redirect_url , flash_notice ) if object . errors . empty? flash [ :notice ] = Alchemy . t ( flash_notice ) do_redirect_to redirect_url else render action : ( params [ :action ] == 'update' ? 'edit' : 'new' ) end end
Displays errors in a #errors div if any errors are present on the object.
Displays errors in a #errors div if any errors are present on the object .
object
<not_specific>
redirect_url
<not_specific>
flash_notice
<not_specific>
<not_specific>
None