[rspec-users] RSpec get model attribute values by name
lists at ruby-forum.com
Sat Jan 31 09:18:09 EST 2009
Pat Maddox wrote:
> I realize you didn't ask for all of that but I'm feeling a bit chatty.
The more information the better. I never really did understand exactly
what using eval() was supposed to accomplish, now I do. Chat away...
I do want to point out that this is what the ActiveRecord::Base api has
to say about the  method:
Returns the value of the attribute identified by attr_name after it has
been typecast (for example, "2004-12-12" in a data column is cast to a
date object, like Date.new(2004, 12, 12)). (Alias for the protected
Notice anything wrong about the api call description? Should not this
Returns the value of the attribute identified by attr_name...
The reason that I raised this question to begin with was because I could
not get "model_instance(attr_name)" to work. Which is what the api is
telling me to do the way that it is written. I came up with the
alternative, write_attribute(attr_name), by looking at the code for .
Posted via http://www.ruby-forum.com/.
More information about the rspec-users