Reputation: 151
I have a prombem when my haml
parse this code:
-if link.user == current_user
%div{:class => "links-group d-inline"}
= link_to "edit", edit_link_path(link) do
= octicon("pencil", :height => 16, :class => "d-inline mt-1")
= link_to 'destroy', link, method: :delete, data: { confirm: 'Are you sure?' }
undefined method `stringify_keys' for "/links/1183/edit":String
When i delete this line = octicon("pencil", :height => 16, :class => "d-inline mt-1")
all works is good.
How fix this problem?
Upvotes: 1
Views: 1013
Reputation: 356
Also you can take a look like below -
link_to(options = {}, html_options = {}) do
# name
end
OR
link_to(url, html_options = {}) do
# name
end
Upvotes: 1
Reputation: 27747
If you pass a block to link_to
then you need to not pass it a label to display as well.
eg
= link_to edit_link_path(link) do
= octicon("pencil", :height => 16, :class => "d-inline mt-1")
OR
= link_to "edit", edit_link_path(link)
but not a combination of both... :)
Here is the API doc for link_to
which gives better examples:
http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to
Upvotes: 2