0
- # Because it relies on url_for, link_to supports both older-style controller/action/id arguments
0
- # and newer RESTful routes. Current Rails style favors
0
- # RESTful routes whenever possible, so use
0
+ # Because it relies on +url_for+, +link_to+ supports both older-style controller/action/id arguments
0
+ # and newer RESTful routes. Current Rails style favors RESTful routes whenever possible, so base
0
+ # your application on resources and use
0
# link_to "Profile", profile_path(@profile)
0
# # => <a href="/profiles/1">Profile</a>
0
# link_to "Profile", @profile
0
# # => <a href="/profiles/1">Profile</a>
0
- # in place of the more verbose
0
+ # in place of the older more verbose, non-resource-oriented
0
- # link_to "Profile", :controller => "profiles", :action => "show", :id => @profile.id
0
+ # link_to "Profile", :controller => "profiles", :action => "show", :id => @profile
0
# # => <a href="/profiles/show/1">Profile</a>
0
# link_to "WRONG!", :controller => "articles", :id => "news", :class => "article"
0
# # => <a href="/articles/index/news?class=article">WRONG!</a>
0
- # link_to can also produce links with anchors or query strings:
0
+ # +link_to+ can also produce links with anchors or query strings:
0
# link_to "Comment wall", profile_path(@profile, :anchor => "wall")
0
# # => <a href="/profiles/1#wall">Comment wall</a>
0
# link_to "Nonsense search", searches_path(:foo => "bar", :baz => "quux")
0
# # => <a href="/searches?foo=bar&baz=quux">Nonsense search</a>
0
- # The three options specfic to link_to (<tt>confirm</tt>, <tt>popup</tt>, and <tt>method</tt>) are used as follows:
0
+ # The three options specfic to +link_to+ (<tt>:confirm</tt>, <tt>:popup</tt>, and <tt>:method</tt>) are used as follows:
0
# link_to "Visit Other Site", "http://www.rubyonrails.org/", :confirm => "Are you sure?"
0
# # => <a href="http://www.rubyonrails.org/" onclick="return confirm('Are you sure?');">Visit Other Site</a>
Comments
No one has commented yet.