From 2ec60f847a17bff6cf24c22362e3802540abe426 Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Mon, 5 May 2014 08:34:15 +1000 Subject: [PATCH 1/3] don't refer to the soviet union but to the latin word. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce19a441..0524b030 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. From cffbbf56c88669a20f64d2050158d6ce6db6c4dd Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Mon, 5 May 2014 10:34:27 +1000 Subject: [PATCH 2/3] add Contract#errors again to make it work with Rails 3.0. --- lib/reform/contract.rb | 5 +++++ 1 file changed, 5 insertions(+) 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?) From 144c37b7461eca358b14f83e29fce106e22f4209 Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Mon, 5 May 2014 10:34:48 +1000 Subject: [PATCH 3/3] releasing 1.0.0 yeeeaaahh! --- CHANGES.md | 10 +++++++--- README.md | 4 ++-- lib/reform/version.rb | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) 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 0524b030..40024059 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ gem 'reform' Reform comes with two base classes. * `Form` is what made you come here - it gives you a form class to handle all validations, wrap models, allow rendering with Rails form helpers, simplifies saving of models, and more. -* `Contract` gives you a sub-set of `Form`: this class is meant for API validation where already populated models get validated without having to maintain validations in the model classes. +* `Contract` gives you a sub-set of `Form`: [this class](#contracts) is meant for API validation where already populated models get validated without having to maintain validations in the model classes. ## Defining Forms @@ -193,7 +193,7 @@ class AlbumContract < Reform::Contract It defines the validations and the object graph to be run. -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/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