I would like to define a class method using Module # relatively ( https://github.com/37signals/concerning - part of Rails 4.1). This will allow me to move the modules that are used by one class back to the class.
However, it seems like I cannot define class methods. Considering this:
class User < ActiveRecord::Base attr_accessible :name concerning :Programmers do module ClassMethods def programmer? true end end end module Managers extend ActiveSupport::Concern module ClassMethods def manager? true end end end include Managers end
I would expect both of them to work:
User.manager? User.programmer?
But the second one causes
NoMethodError: undefined method `programmer?' for #<Class:0x007f9641beafd0>
How to define class methods using module # related to?
ruby-on-rails ruby-on-rails-3
John naegle
source share