RubyRube RubyRube - 4 years ago 109
Ruby Question

Incorrect symbols: Devise returns syntax error when coloring text on buttons

I am configuring an upload form for a crowdfunding site.

The following code works. It gives me white text on the Edit Profile button:

<button class="btn btn-success large"><%= link_to 'Edit profile', edit_user_registration_path, {:style=>'color:#FFFFFF;', :class => 'navbar-link' "css-class"}%></button>


But when I try and add colors to the following line, Devise returns a syntax error:

<button class="btn btn-success large"><%= link_to "Logout", destroy_user_session_path, method: :delete {:style=>'color:#FFFFFF;', :class => 'navbar-link' "css-class"}%></button>


The problem is incorrect syntax/symbols between the words
:delete
and
{:style
. I have followed the error messages and tried every combination of symbols
, : => (
and
{
but none are correct.

I'm making a syntax error, but am not sure what. Thanks if you can help.

Answer Source

Try this

<%= link_to "Logout", destroy_user_session_path, method: :delete,:style=>"color:#FFFFFF;", :class => "navbar-link css-class" %>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download