link_options doesn't work
turbod opened this issue · comments
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.
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? }
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.
You're correct. It should be added. In the meantime, I always change devise sign out to get instead of delete.
Yes, but I think it's not a good solution.
then don't do it. =)
You can provide link_html as an options hash btw.