I have a helper method that I want to use for several models to save having to repeat the same code several times.
def link_to_follow(instance:instance,type:type)
link_to('Unfollow', unfollow_books_path(id: instance.id),
method: :post,
id: "unfollow_link_#{instance.id}",
remote: true)
end
How do I do it so that if I pass type:'magazine'
as a variable then unfollow_books_path
becomes unfollow_magazines_path
?