I'm using Rails 3.2.11 and Ruby 1.9.3 in Mac OS X Mountain Lion
I have a user model, and i created a virtual attribute called message
attr_accessor :message
In my code, i try this:
if condition == true
self.message = "Value is True."
else
self.message = "Value is not True"
In my controller, I try this
def method
user = User.find(1)
flash[:message] = user.message
end
But the flash message doesn't display anything. It's nil. How can I pass the value I set in the model to the controller? thanks a lot!