Reputation: 48475
I'm not sure what I'm doing wrong here, I have a file in lib/acts_as_votable.rb
, it's just a votable system for the app.
module ActsAsVotable
end
module ActiveRecord
class Base
class << self
cattr_accessor :votable
def acts_as_votable
has_many :votes, :as => :voteable
end
def votable?
method_defined? :votes
end
end
def votable?
self.class.send(:method_defined?, :votes)
end
end
end
But it seems that the module never loads:
undefined local variable or method `acts_as_votable' for #<Class:0x00000101796d80>
What would be the proper way to load modules?
Upvotes: 0
Views: 606
Reputation: 6585
Not sure that the OP's desired functionality is related to configuration. To load files within /lib you can add the following to /config/application.rb:
config.autoload_paths += %W(#{config.root}/lib/)
Upvotes: 0
Reputation: 13428
You may put your extensions in the config/initializers
directory, so they will be preloaded by Rails automatically.
Upvotes: 2