Update "Has-One Associations" section in README [ci skip]
This commit is contained in:
parent
44a632eea6
commit
5aea822771
|
@ -597,8 +597,14 @@ If you can think of a good way to achieve this, please let me know.
|
||||||
PaperTrail can restore `:has_one` associations as they were at (actually, 3 seconds before) the time.
|
PaperTrail can restore `:has_one` associations as they were at (actually, 3 seconds before) the time.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
class Location < ActiveRecord::Base
|
||||||
|
belongs_to :treasure
|
||||||
|
has_paper_trail
|
||||||
|
end
|
||||||
|
|
||||||
class Treasure < ActiveRecord::Base
|
class Treasure < ActiveRecord::Base
|
||||||
has_one :location
|
has_one :location
|
||||||
|
has_paper_trail
|
||||||
end
|
end
|
||||||
|
|
||||||
>> treasure.amount # 100
|
>> treasure.amount # 100
|
||||||
|
|
Loading…
Reference in New Issue