How can I do a link_to
that I can modify like the object class string?
First off, I have my objects as polymorphic (book, magazine) so I need to user link_to(@object.title, [@object.user, @object])
. This make's it polymorphic like user_book_path
or user_magazine_path
as expected.
My question is how can I change the user
part to writer eg. writer_magazine_path
or writer_book_path
? Cause in my routes I have named user as writer
and I'm wondering how I can do it to the link_to
method.
note Don't know if I titled it correctly. Correct it if so.