diff options
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/activerecord_validations_callbacks.textile | 10 | ||||
-rw-r--r-- | railties/guides/source/routing.textile | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/railties/guides/source/activerecord_validations_callbacks.textile b/railties/guides/source/activerecord_validations_callbacks.textile index d83ea57864..1f9bc1279a 100644 --- a/railties/guides/source/activerecord_validations_callbacks.textile +++ b/railties/guides/source/activerecord_validations_callbacks.textile @@ -115,17 +115,17 @@ end >> p = Person.new => #<Person id: nil, name: nil> >> p.errors -=> #<ActiveRecord::Errors..., @errors={}> +=> {} >> p.valid? => false >> p.errors -=> #<ActiveRecord::Errors..., @errors={"name"=>["can't be blank"]}> +=> {:name=>["can't be blank"]} >> p = Person.create => #<Person id: nil, name: nil> >> p.errors -=> #<ActiveRecord::Errors..., @errors={"name"=>["can't be blank"]}> +=> {:name=>["can't be blank"]} >> p.save => false @@ -1112,6 +1112,10 @@ h4. Creating Observers For example, imagine a +User+ model where we want to send an email every time a new user is created. Because sending emails is not directly related to our model's purpose, we could create an observer to contain this functionality. +<shell> +rails generate observer User +</shell> + <ruby> class UserObserver < ActiveRecord::Observer def after_create(model) diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 2bc1736137..79c5f4fabe 100644 --- a/railties/guides/source/routing.textile +++ b/railties/guides/source/routing.textile @@ -717,7 +717,7 @@ resources :magazines do end </ruby> -This will create routing helpers such as +periodical_ads_url+ and +periodical_edit_ad_path+. +This will create routing helpers such as +magazine_periodical_ads_url+ and +edit_magazine_periodical_ad_path+. h3. Inspecting and Testing Routes |