0

I need to override all the new actions of several models in AA. Currently I am overriding the models one by one, so I have a lot of duplicated code.

How can I edit all the new actions in one shot?

Just to give some background, I'm doing this in each AA resource file:

controller do
  def new
    # things
  end
end
davideghz
  • 3,596
  • 5
  • 26
  • 50

1 Answers1

1

you should create a module and write your methods in that module, then include the module in every controller

class YourController < ApplicationController
  include YourControllerConcern
  # rest of the controller codes
end

but read the full original answer which I am quoting, that has additional info

while if you never used include this is a good explanation of what it does and this is a complete guide about include and extend

Fabrizio Bertoglio
  • 5,890
  • 4
  • 16
  • 57