lib/faalis/dashboard/sections/resource.rb in faalis-2.0.4 vs lib/faalis/dashboard/sections/resource.rb in faalis-2.0.5

- old
+ new

@@ -130,23 +130,28 @@ f.html { redirect_to path } end end end - def errorful_resopnse(section, msg = nil) + def errorful_resopnse(section, msg = nil, &block) @_msg = msg respond_to do |f| if _override_views.include? section.to_sym f.js { render :errors } f.html { render :errors } else flash[:error] = msg + path = Rails.application.routes.url_helpers.send(@index_route) # TODO: We really need to put setup routed on top of this method f.js { render 'faalis/shared/errors' } - f.html { redirect_to path } + if block_given? + f.html(&block) + else + f.html { redirect_to path } + end end end end # TODO: Move this method to a suitable place