Search code examples
ruby-on-railshamllink-to

Using link_to on a list element in rails


I'm trying to making the final list element a clickable link to my search_path in rails using HAML but have been unable to make it work. Here is what I have so far:

  %li
    = link_to('sign out', destroy_user_session_path, :method => :delete)
  %li
    = link_to "profile", edit_user_registration_path
  %li{:style => 'background-color:#3D8599;'}
    %i.fa.fa-search

Everything I have tried results in the fa-search icon being put in the wrong place or not being clickable.


Solution

  • Have you tried this?

    %li{:style => 'background-color:#3D8599;'}
      = link_to search_path do
        %i.fa.fa-search