link_options doesn't work
turbod opened this issue · 6 comments
turbod commented
Hi,
I can't set the link_options.
I would like to set a logout link:
n.item 'Sign out', 'destroy_user_session_path', method: 'delete', hidden_unless: proc{ user_signed_in? }
but the link_optins in the builder.link_generator are empty.
shekibobo commented
Your second argument, destroy_user_session_path
, is a method that returns the actual path of that item. What happens if you remove the quotes around it?
n.item 'Sign out', destroy_user_session_path, method: :delete, hidden_unless: proc{ user_signed_in? }
turbod commented
I get this error message:
undefined local variable or method `destroy_user_session_path' for main:Object
If I use a proc like this:
n.item 'Sign out', proc { destroy_user_session_path }, method: :delete, hidden_unless: proc{ user_signed_in? }
I didn't get error message, but the link_options still empty.
jejacks0n commented
You're correct. It should be added. In the meantime, I always change devise sign out to get instead of delete.
turbod commented
Yes, but I think it's not a good solution.
jejacks0n commented
then don't do it. =)
jejacks0n commented
You can provide link_html as an options hash btw.