SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Add classes to link_to

    Hey all,

    I have the following code:

    Code:
    <%= link_to 'specials' ,:controller => 'special',:class=>'currentSection' %>
    But when it's rendered the class='currentSection' is appended as a variable at the end of the URL. I want it to set the class of the URL. What am I doing wrong?

  2. #2
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:
    Code:
      <&#37;= link_to 'special', {:controller => 'special'}, {:class => 'currentSection'} %>
    If you give someone a program,
    you will frustrate them for a day;
    if you teach them how to program,
    you will frustrate them for a lifetime.

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yay. Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •