Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a class to link_to

I have been trying to add a class to my link_to for over an hour now. No matter what I try, I get an error.

<% if user_signed_in? %>
  <li>
  <%= link_to('Sign out', destroy_user_session_path, :method => :delete) %>
  </li>
<% else %>
  <li>
  <%= link_to('Sign in', new_user_session_path) %>
  </li>
<% end %>

I am trying to add :class => "page-scroll btn-signin" to both of my link_to lines.

like image 403
GVS Avatar asked Mar 19 '26 16:03

GVS


1 Answers

I solved the problem

<%= link_to 'Sign out', destroy_user_session_path, :method => :delete, :class => "page-scroll btn-signin" %>

This code works correctly.

like image 106
GVS Avatar answered Mar 21 '26 04:03

GVS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!