Trying to add acts_as_list to Issue
Added by Mark Maglana over 17 years ago
I'm experimenting with plugins and tried to follow the instructions that Eric gave regarding extending Redmine's core models. The one thing I wanted to do is to make the Issue act as a list (acts_as_list). Here's what I did:
In init.rb
In lib/issue_patch.rb
require_dependency 'issue'
module IssuePatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
acts_as_list :scope => :project
end
end
module ClassMethods
end
module InstanceMethods
end
end
Issue.send(:include, IssuePatch)
I try this out in script/console with Issue.find(:first).insert_at and it works like a charm. However, when I try to do the same thing in one of my plugin's controllers, I get a NoMethodError:
What am I missing? :-)
Replies (4)
RE: Trying to add acts_as_list to Issue
-
Added by Mark Maglana over 17 years ago
RE: Trying to add acts_as_list to Issue
-
Added by Mark Maglana over 17 years ago
Hmmm...I take that back. Sometimes it works, sometimes it doesn't. What gives?
RE: Trying to add acts_as_list to Issue
-
Added by Mark Maglana over 17 years ago
RE: Trying to add acts_as_list to Issue
-
Added by Eric Davis over 17 years ago
For others who run into this:
I've done a blog post that shows what's happening internally along with how to fix it: http://theadmin.org/articles/2009/4/13/how-to-modify-core-redmine-classes-from-a-plugin
Eric Davis