mercredi 25 février 2015

Methods included not found after upgrading to Rails 4

After upgrading to Rails 4.2.0 from Rails 3.2.12, the following code in module WfHelper is broken:



def self.included(base)
base.before_action :load_wf_action_def
end


Here is base is the quotes controller. Method load_wf_action_def runs a eval to include some methods to make them available to quotes controller. In quotes controller, there includes:



include BizWorkflowx::WfHelper


None of the methods supposedly loaded by load_wf_action_def was there for quotes controller.


Which new feature in rails 4.2 could break the code? In debug, the QuotesController.public_instance_methods in Rails 4 does not return _one_time_conditions_valid_# which is imposed by execution of filter (action in Rails 4). In Rails 3, it does show the _one_time_conditions_valid_# for the before_filter executed.


Aucun commentaire:

Enregistrer un commentaire