def get_link(resource)
link_to "#{resource.capitalize}", send("#{resource}_path")
end
Maximiliano Guzman
2009-04-13 17:04:35
def get_link(resource)
link_to "#{resource.capitalize}", send("#{resource}_path")
end
def get_link(resource) link_to(resource.to_s.titleize, send("#{resource}_path")) end
The to_s call on resource is to support passing symbols as resource. So
get_link("foos")
will work and also
get_link(:foos)
If you want to construct a RESTful route with a member:
send("edit_#{resource}_path".to_sym, @resource)