Access model from rake


is it possible to access methods I add to my models from a rake task?
adding “=> :environment” seem to enable only the methods defined in
ActiveRecord::Base. Calling other methods results in:
undefined method `mehodname’ for ModelName

There’s probably something else going on.

To quote:

Can you access your models in a rake task? Very Yes! :wink:

Are you mixing up class and instance methods?


you were right,
I am new to ruby so I was not correctly declaring methods
thanks for pointing me to class and instance methods
that knowledge seemed to do the trick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs