[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem with saving associated object

Jakub Kuzma

2/16/2008 9:59:00 PM

Hi!
I've following problem:

class City < ActiveRecord::Base
has_one :marker
end

class Marker < ActiveRecord::Base
belongs_to :city
end

>> city = City.find(1)
=> #<City id: 1, name: "Warsaw", created_at: "2008-02-16 22:25:43",
updated_at: "2008-02-16 22:26:53">
>> city.marker.latitude = 60.0
=> 60.0
>> city.save
=> true
>> city.marker.latitude
=> 60.0
>> city.reload
=> #<City id: 1, name: "Warsaw", created_at: "2008-02-16 22:25:43",
updated_at: "2008-02-16 22:28:17">
>> city.marker.latitude
=> 50.0

AFAIR it worked in Rails 1.2. How to get behavior like above in Rails
2.0? Any advice would be appreciated :-).

TIA - Jakub Kuzma.