Skip to content

Commit

Permalink
doc changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed May 4, 2014
1 parent 3f4124d commit f017d87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ To add fields to the form use the `::property` method. Also, validations no long
Forms have a ridiculously simple API with only a handful of public methods.

1. `#initialize` always requires a model that the form represents.
2. `#validate(params)` will run all validations for the form with the input `params`. Its return value is either `true` or `false` if validations were not satisfied.
2. `#validate(params)` will run all validations for the form with the input data. Its return value is the boolean result of the validations.
3. `#errors` returns validation messages in a classy ActiveModel style.
4. `#sync` writes form data back to the model.
4. `#sync` writes form data back to the model. This will only use setter methods on the model(s).
5. `#save` (optional) will call `#save` on the model and nested models. Note that this implies a `#sync` call.

In addition to the main API, forms expose accessors to the defined properties. This is used for rendering or manual operations.
Expand Down
12 changes: 10 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* document Form#to_hash and Form#to_nested_hash (e.g. with OpenStruct composition to make it a very simple form)
* document getter: and representer_exec:

* allow :as to rename nested forms
* Debug module that logs every step.

vererben in inline representern (module zum einmixen, attrs löschen)

Expand All @@ -13,4 +13,12 @@ vererben in inline representern (module zum einmixen, attrs löschen)
# form.messages should then go through them and compile a "summary" instead of adding them to the parents #errors in #validate.


in a perfect world, a UI form would send JSON as in the API. that's why the reform form creates the correct object graph first, then validates. creating the graph usually happens in the API representer code.

in a perfect world, a UI form would send JSON as in the API. that's why the reform form creates the correct object graph first, then validates. creating the graph usually happens in the API representer code.


WHY DON'T PEOPLE USE THIS:
http://guides.rubyonrails.org/association_basics.html#the-has-many-association
4.2.2.2 :autosave

If you set the :autosave option to true, Rails will save any loaded members and destroy members that are marked for destruction whenever you save the parent object.

0 comments on commit f017d87

Please sign in to comment.