0

I have added a custom class to the lib folder and can initialize the class and call an attribute but can not call a method from the class without getting the following error

undefined method `colour' for #

Any ideas what I'm doing wrong?

I'm using rails 3

Sam
  • 33
  • 1
  • 3

1 Answers1

0

Can we see some code? Which version of rails?

My understanding is that not everything from lib is automatically loaded in rails 3.

See this post:
Best way to load module/class from lib folder in Rails 3?

Why not move the class to the models folder? I don't use lib so much anymore...

Community
  • 1
  • 1
doublea
  • 2,546
  • 1
  • 23
  • 35
  • Moving it to the models folder should only be done if it's actually a model though... – sarahhodne Jul 11 '11 at 19:08
  • Agreed... and I certainly didn't mean to suggest that one can or should throw anything in the models folder. But we could have a little debate about what a 'model' is, exactly. All I really meant is that not every model should have to wrap a database table. It's fine to have plain ruby classes, or classes that include some, but not all ActiveModel modules, etc. – doublea Jul 12 '11 at 00:11