I want my helpers to generate paths using a superclass instead of the 
subclasses. Assuming I have Owner and Member that both inherit from User, 
rails will use the current objects class name when generating paths:

Let's say current_user is a mod: <%= link_to current_user.name, 
current_user %> will generate "/mod/:id". I want to force it to generate 
"/user/:id" regardless of the subclass.

I can name the path:
<%= link_to current_user.name, user_path(current_user) %>

But I still want to use the convenience of just passing the object:
<%= link_to current_user.name, current_user %>

Is this possible?


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/EyihglN5e3cJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to