I'm just a beginner using Ruby on Rails for building website.. Here they hv not clearly mentioned the difference between link_to and link_to_unless_current plz help as soon as possible
A:
Link_to refers to "redirecting no matter what", and link_to_unless_current redirects unless it is already the current page.
MarceloRamires
2010-01-28 12:33:45
+1
A:
link_to will always generate a link.
link_to_unless_current will be ignored if the url it would link to is the same as the url that rendered the view containing it.
EmFi
2010-01-28 12:34:42
A:
link_to
just generates a link, link_to_unless_current
only creates the link if the current page is not equal to the link you provided.
There is also a link_to_unless
method, where you can provide a custom condition when to show the link.
For more information take a look at the UrlHelper documentation.
Veger
2010-01-28 12:37:07