Ruby on Rails Monday, October 3, 2011

ruby-1.9.3-rc1 :001 > @hunting = Hunting.find(1)
Hunting Load (7.7ms) SELECT "huntings".* FROM "huntings" WHERE
"huntings"."id" = $1 LIMIT 1 [["id", 1]]
=> #<Hunting id: 1, path: "((7,6),(5,4))", created_at: "2011-10-02
16:02:11", updated_at: "2011-10-03 20:01:45">
ruby-1.9.3-rc1 :002 > @hunting.path = Path.new("((5,4))")
=> ((5,4))
ruby-1.9.3-rc1 :003 > @hunting.path
=> ((5,4))
ruby-1.9.3-rc1 :004 > @hunting.path_was
=> "((7,6),(5,4))"
ruby-1.9.3-rc1 :005 > @hunting.changes
=> {"path"=>["((7,6),(5,4))", ((5,4))]}
ruby-1.9.3-rc1 :006 > @hunting.save
(0.2ms) BEGIN
(0.7ms) UPDATE "huntings" SET "path" = '((5,4))', "updated_at" =
'2011-10-04 04:53:54.121491' WHERE "huntings"."id" = 1
(28.8ms) COMMIT
=> true

Works fine.

Actually, there is no "before_save" in my model.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment