Search code examples
ruby-on-railscontrollersactivescaffoldinstance-methods

Setting instance variables with ActiveScaffold


I've recently added ActiveScaffold to an existing Rails project, and the problem I'm having is that the variable names that ActiveScaffold is using are not the same as the ones I already have. Rather than going through my entire application and changing all of the instance variable names, I'd like to be able to set the instance variables in the controller. The problem is that @record and @records cannot be called in before_filters, even if the before_filter is after the active_scaffold call. Looking through the plugin, I see no obvious hook inside of the ActiveScaffold::Actions modules. I'm wondering:

  1. Is there such a hook?
  2. If not, how should I put one in?

Solution

  • the way to do this is to overwrite the do_show, do_create, do_list, etc... methods in the controller.