Can I prevent Rails from passing in instance variables from the controller to view?

Is there a way to disable automatic passing of Rails instance variables to views when they are rendered? I wish I could turn this off and then see where things fail to set up refactoring.

+3


source to share


1 answer


You have to do this by overriding view_assigns

in your controller:



class SomeController < ApplicationController
  protected
   def view_assigns
   {} #an empty hash
   end
end

      

+8


source







All Articles