I would like to specify a named scope in a Module, to keep DRY. Example:
class Article < < ActiveRecord::Base
include ReferenceData
# ...
end
module ReferenceData
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
named_scope :released, :conditions => {:is_released => true}
end
end
This does not work:
>> Article.released
NoMethodError: undefined method `named_scope'' for
ReferenceData::ClassMethods:Module
Do you know how to specify my named scope inside a mixin module?
Thanks a lot,
Ewald
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.