diff --git a/CHANGES.md b/CHANGES.md index 3ae959df..60ea8706 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,9 +8,13 @@ ``` * Allow passing symbol hash keys into `#validate`. * Unlimited nesting of forms, if you really want that. -save on all nested, disable with save: false -composition simplified, empty fields, save ("everything works with everything") -* as: now works +* `save` gets called on all nested forms automatically, disable with `save: false`. +* Renaming with `as:` now works everywhere. +* Fixes to make `Composition` work everywhere. +* Extract setup and validate into `Contract`. +* Automatic population with `:populate_if_empty` in `#validate`. +* Remove `#from_hash` and `#to_hash`. +* Introduce `#sync` and make `#save` less smart. ## 0.2.7 diff --git a/README.md b/README.md index 0d5c8d31..cb07b7b9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Add this line to your Gemfile: gem 'reform' ``` -## Nomenklatura +## Nomenclatura Reform comes with two base classes. @@ -193,7 +193,7 @@ class AlbumContract < Reform::Contract It defines the validations and the object graph to be inspected. -In future versions and with the upcoming [Trailblazer framework](https://github.com/apotonick/trailblazer), contracts can be inherited from forms, representers, and cells, and vice-versa. +In future versions and with the upcoming [Trailblazer framework](https://github.com/apotonick/trailblazer), contracts can be inherited from forms, representers, and cells, and vice-versa. Actually this already works with representer inheritance - let me know if you need help. ### Using Contracts diff --git a/lib/reform/contract.rb b/lib/reform/contract.rb index 990b0116..f74a7f9c 100644 --- a/lib/reform/contract.rb +++ b/lib/reform/contract.rb @@ -79,6 +79,11 @@ def create_accessor(name) include Validate + def errors # FIXME: this is needed for Rails 3.0 compatibility. + @errors ||= Errors.new(self) + end + + private attr_accessor :fields attr_writer :errors # only used in top form. (is that true?) diff --git a/lib/reform/version.rb b/lib/reform/version.rb index d8242b04..72252333 100644 --- a/lib/reform/version.rb +++ b/lib/reform/version.rb @@ -1,3 +1,3 @@ module Reform - VERSION = "0.2.7" + VERSION = "1.0.0" end