On Apr 11, 11:43 pm, Ps_gem Sh_gem <[email protected]>
wrote:
> My 'updatefeed' function is working on application well. But my test
> doesn't show the updated 'lastupdated' column date but only the value in
> fixture. Shouldn't the fixture value be updated on execution and after
> comparison set it back?
If you do SomeMode.find(123) twice, you'll get back two separate
objects (that both correspond to the row in the database with id 123.
The way you've written your code, the updatefeed method loads a
separate copy of the feed and updates that, but you do your assertion
on a separate copy of it. You would need to reload it to see the
change you made. It's also a bit odd that you've made updatefeed a
class method - looks much more like an instance method to me - you
also probably don't want to be using an instance variable in there.
Lastly, if you table has an updated_at column, rails will fill that in
for you everytime you save the object.
Fred
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---