Changing Current Tab in Rails

后端 未结 8 1101
北荒
北荒 2020-12-28 10:05

I have a list of tabs at the top of my application that I include in a general layout in application.html.erb. They look like this:

  • 8条回答
    •  忘掉有多难
      2020-12-28 10:33

      I did this in the application helper and it seems to work fine:

      def current_page(path)
        "active" if current_page?(path)
      end
      

      Then call like this:

    • <%= link_to "Home", root_path %>
    提交回复
    热议问题