controller concerns in rails 4, sharing actions -
I am trying to share an action between controllers using a concern for example:
Extend the module backend module ActiveSupport :: do the anxiety DRAF response_to | Format | [Edit] P> Are you seeing any problems with this? Should I never share common actions with rail worries?
backend.rb ) You Concerns can create a file in the directory (such as your module: backend.rb ) and here is your code: < / P>
Module Backend Df Show Answer- do do | Format | Format.xls {set_excel_headers "# {controller_name.classify} _ # {params [: id]} _ # {time.now.to_i.to_s} .xls"} end and end
Then you add to your controller:
expansion backend
Comments
Post a Comment