I have an ActiveRecord model with a cattr_accessor. The class
attribute is set up like this:
class MyModel < ActiveRecord::Base
cattr_accessor :my_attribute
end
Because I need to give #my_attribute environment-specific values, I
try to set this attribute in environments/development.rb like so:
MyModel.my_attribute = 3
But this leads to odd and erratic behavior when #my_attribute is
called from a controller. Sometimes MyModel.my_attribute returns 3,
but sometimes it returns nil.
Any suggestions?