ruby-1.9.3-rc1 :071 > @hunting = Hunting.find(1)
Hunting Load (0.5ms) 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 19:16:44">
ruby-1.9.3-rc1 :072 > @hunting.path
=> ((7,6),(5,4))
ruby-1.9.3-rc1 :073 > @hunting.changed?
=> false
ruby-1.9.3-rc1 :074 > @hunting.changes
=> {}
ruby-1.9.3-rc1 :075 > @hunting.one_step_forward
=> (7,6)
ruby-1.9.3-rc1 :076 > @hunting.path
=> ((5,4))
ruby-1.9.3-rc1 :077 > @hunting.changed?
=> true
ruby-1.9.3-rc1 :078 > @hunting.changes
=> {"path"=>[((5,4)), ((5,4))]}
ruby-1.9.3-rc1 :079 > @hunting.changed_attributes
=> {"path"=>((5,4))}
ruby-1.9.3-rc1 :080 > @hunting.save
(0.2ms) BEGIN
(0.5ms) UPDATE "huntings" SET "path" = '((7,6),(5,4))',
"updated_at" = '2011-10-03 19:30:15.467748' WHERE "huntings"."id" = 1
(23.5ms) COMMIT
=> true
Ok, path_was == path, don't know why, but where the hell rails found
the '((7,6),(5,4))' used in the SQL statement?
I found a way to "fix" the issue but i don't really like it:
ruby-1.9.3-rc1 :118 > @hunting = Hunting.find(1)
Hunting Load (0.5ms) 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 19:53:11">
ruby-1.9.3-rc1 :119 > @hunting.one_step_forward
=> (7,6)
ruby-1.9.3-rc1 :120 > Hunting.update(@hunting.id, { :path =>
@hunting.path })
Hunting Load (0.5ms) SELECT "huntings".* FROM "huntings" WHERE
"huntings"."id" = $1 LIMIT 1 [["id", 1]]
(0.2ms) BEGIN
(1.1ms) UPDATE "huntings" SET "path" = '((5,4))', "updated_at" =
'2011-10-03 19:53:37.810688' WHERE "huntings"."id" = 1
(26.7ms) COMMIT
=> #<Hunting id: 1, path: "((5,4))", created_at: "2011-10-02
16:02:11", updated_at: "2011-10-03 19:53:37">
--
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