README.md in act_form-0.2.0 vs README.md in act_form-0.3.0

- old
+ new

@@ -29,12 +29,12 @@ form = UserForm.new(age: '18', address: 'somewhere') form.valid? # => false form.errors.full_messages # => ["Name require a value"] ``` -#### Difference between then `required` and `validates_presence_of` -`required` run before validation, it will cancel other validations if return false. +#### Difference between `required` and `validates_presence_of` +`required` will run before the validation, and it will cancel other validations if return false. ### form object #### API - `valid?` Compliant with the active model api @@ -75,11 +75,11 @@ @saved = true end end.new form = PhoneForm.new(phone: '12345678901') -form.save(target) +form.save(target) # same as form.sync(target) and target.save target.phone # => '12345678901' target.saved # => true form.persisted? # => true ``` @@ -97,10 +97,11 @@ target.phone = '12345678901' form = PhoneForm.new form.init_by(target) +form.phone # => '12345678901' form.save # => true target.saved # => true ``` #### API - `combine` @@ -150,12 +151,15 @@ ```ruby class CreateUserCommand < ActForm::Command combine UserForm def perform - # User.create(attributes) + User.create(attributes) end end + +CreateUserCommand.new +# => NoMethodError: private method `new' called for CreateUserCommand:Class command = CreateUserCommand.run(phone: '12345678901') if command.success? @user = command.result # do something...