Actions
Patch #19134
closedHow to override the model method visible_condition
Status:
Closed
Priority:
Urgent
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Description
I want to override the model method with my plugin. I tried to create a new model Patch with method that should override like this:
require_dependency 'issue'
module IssuePatch
def self.included(base) # :nodoc:
base.send(:extend, ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method :visible_condition, :visible_condition_with_patch
end
end
module ClassMethods
end
module InstanceMethods
def visible_condition_with_patch(user, options={})
<Do Something>
end
end
end
Rails.configuration.to_prepare do
unless Issue.included_modules.include? IssuePatch
# Issue.extend(InstanceMethods)
Issue.send(:include, IssuePatch)
end
end
Actions