On 2/22/07, Chris Abad <[EMAIL PROTECTED]> wrote:
one more thing. if you're trying to match the controller name, this is a bit
easier:
controller.controller_name == 'main'

In addition to all the great advice above in this thread, I will also
say that this is a handy place to use named routes.

Consider:
map.home '', :controller => 'main', :action => 'show'

Not only can you call something like <%= link_to 'Home', home_path %>
but you can also use the perhaps-lesser-known hash_for_home_path. A
call to hash_for_home_path as defined above would return just what you
expect:
{:controller=>"main", :action=>"show"}

If your helper is smart enough (and your IA simple enough), you could
conceivably have a call that looks like this:

navigation_link_to "Home", hash_for_home_path

Those hash_for methods should save some characters, not to mention
some time spent thinking up what belongs in those hashes, and your
helper still gets to work with a hash.

--
Nick Zadrozny • http://missionsbridge.org/people/nick
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to