adding a method and html options to link_to in rails?
ruby, ruby-on-rails, ruby-on-rails-3
Solution
Try placing both `:class` and `:method` inside the hash.
So: `<%= link_to "Sign out", destroy_user_session_path, { :class => 'signout', :method => :delete} %>`
Problem
I'm brand new to ruby and rails and I'm having trouble creating a sign-out link (using devise for auth). I want to pass a custom :method parameter into the link_to function, and set a custom class. I seem to be able to do one or the other but not both. When I try: ``` <%= link_to "Sign out", destroy_user_session_path, :method => :delete, { :class => 'signout'} %> ``` I get the proper result from clicking the link, but I lose my styling. On the other hand, when I try: ``` <%= link_to "Sign out", destroy_user_session_path, { :class => 'signout'}, :method => :delete %> ``` I get the styling I want but the link request is passed as GET rather than DELETE, resulting in a routing error. What am I missing?