diff options
author | Andreas Scherer <andreas_coder@freenet.de> | 2009-02-11 18:40:44 +0100 |
---|---|---|
committer | Andreas Scherer <andreas_coder@freenet.de> | 2009-02-11 18:40:44 +0100 |
commit | b6fcc471e2edfdf26077a94425d27b1127b94c10 (patch) | |
tree | 7ad988e01e50be0d1df8c5845f13e7868017d9b0 /railties/guides | |
parent | 37411e9e57ed04a0c3683edf3e369b821b853922 (diff) | |
download | rails-b6fcc471e2edfdf26077a94425d27b1127b94c10.tar.gz rails-b6fcc471e2edfdf26077a94425d27b1127b94c10.tar.bz2 rails-b6fcc471e2edfdf26077a94425d27b1127b94c10.zip |
Use explicit HTML charnames for textile-formatted <code/>.
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/2_3_release_notes.textile | 2 | ||||
-rw-r--r-- | railties/guides/source/routing.textile | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/railties/guides/source/2_3_release_notes.textile b/railties/guides/source/2_3_release_notes.textile index 5268ebe3d4..39f06aac31 100644 --- a/railties/guides/source/2_3_release_notes.textile +++ b/railties/guides/source/2_3_release_notes.textile @@ -407,7 +407,7 @@ Active Support has a few interesting changes, including the introduction of +Obj h4. Object#try -A lot of folks have adopted the notion of using try() to attempt operations on objects. It's especially helpful in views where you can avoid nil-checking by writing code like +<%= @person.try(:name) %>+. Well, now it's baked right into Rails. As implemented in Rails, it raises +NoMethodError+ on private methods and always returns +nil+ if the object is nil. +A lot of folks have adopted the notion of using try() to attempt operations on objects. It's especially helpful in views where you can avoid nil-checking by writing code like +<%= @person.try(:name) %>+. Well, now it's baked right into Rails. As implemented in Rails, it raises +NoMethodError+ on private methods and always returns +nil+ if the object is nil. * More Information: "try()":http://ozmm.org/posts/try.html. diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index d07c634a35..28e5c5b934 100644 --- a/railties/guides/source/routing.textile +++ b/railties/guides/source/routing.textile @@ -250,9 +250,9 @@ Rails allows you to group your controllers into namespaces by saving them in fol map.resources :adminphotos, :controller => "admin/photos" </ruby> -If you use controller namespaces, you need to be aware of a subtlety in the Rails routing code: it always tries to preserve as much of the namespace from the previous request as possible. For example, if you are on a view generated from the +adminphoto_path+ helper, and you follow a link generated with +<%= link_to "show", adminphoto(1) %>+ you will end up on the view generated by +admin/photos/show+ but you will also end up in the same place if you have +<%= link_to "show", {:controller => "photos", :action => "show"} %>+ because Rails will generate the show URL relative to the current URL. +If you use controller namespaces, you need to be aware of a subtlety in the Rails routing code: it always tries to preserve as much of the namespace from the previous request as possible. For example, if you are on a view generated from the +adminphoto_path+ helper, and you follow a link generated with +<%= link_to "show", adminphoto(1) %>+ you will end up on the view generated by +admin/photos/show+, but you will also end up in the same place if you have +<%= link_to "show", {:controller => "photos", :action => "show"} %>+ because Rails will generate the show URL relative to the current URL. -TIP: If you want to guarantee that a link goes to a top-level controller, use a preceding slash to anchor the controller name: +<%= link_to "show", {:controller => "/photos", :action => "show"} %>+ +TIP: If you want to guarantee that a link goes to a top-level controller, use a preceding slash to anchor the controller name: +<%= link_to "show", {:controller => "/photos", :action => "show"} %>+ You can also specify a controller namespace with the +:namespace+ option instead of a path: |