Skip to content

Instantly share code, notes, and snippets.

@Mikr0Tik
Created September 25, 2008 08:25
Show Gist options
  • Save Mikr0Tik/12783 to your computer and use it in GitHub Desktop.
Save Mikr0Tik/12783 to your computer and use it in GitHub Desktop.
template = 'people' # depends on the template
...
@nested_object = self.instance_variable_get(:"@#{params[:controller].singularize}") if show_action?
...
attributes.each do |attribute|
route = @nested_object ? self.send("#{params[:controller].singularize}_#{template}_path", @nested_object, {:order=>order}) : self.send("#{params[:controller]}_path", {:order=>order})
link_to('Fooo', route)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment