diff options
author | Peter Markou <peter@grc.org> | 2014-03-07 16:08:08 +0200 |
---|---|---|
committer | Peter Markou <peter@grc.org> | 2014-03-08 21:19:42 +0200 |
commit | f6ab778297350aa3dad1dbf23ccd2d8a74e3dab7 (patch) | |
tree | 69f8fc7b387564a6458d8dc017541cda05ba1bf3 /RELEASING_RAILS.rdoc | |
parent | 1fbb9056ef9d9c1718d88fb19ae54d17806ca4ce (diff) | |
download | rails-f6ab778297350aa3dad1dbf23ccd2d8a74e3dab7.tar.gz rails-f6ab778297350aa3dad1dbf23ccd2d8a74e3dab7.tar.bz2 rails-f6ab778297350aa3dad1dbf23ccd2d8a74e3dab7.zip |
Fix errors for four of the code samples
The four code samples that fail to run are:
- Add attribute magic to objects. Fixed by introducing a Person
instance variable.
- Tracking value changes. Fixed by replacing `attr_accessor` with
`define_attribute_methods`, providing getter and setter methods
for `name` and providing the missing `Person#save` method. A
call to `Person#save` has to precede the `person.name = 'robert'`
assignment, if we want `previous_changes` to include 'bob'.
- Adding `errors` interface to objects. Fixed by introducing a
Person instance variable, assigning `nil` to its name and calling
`Person#validate!`.
- Custom validators. Fixed by defining `HasNameValidator` before
it is used by `ValidatorPerson`.
All the code samples can now be run smoothly.
Call Dirty#changes_applied in Person#save, instead of modifying instance vars.
Diffstat (limited to 'RELEASING_RAILS.rdoc')
0 files changed, 0 insertions, 0 deletions