Skip to content

Instantly share code, notes, and snippets.

@mculp
Created July 31, 2012 05:19
Show Gist options
  • Select an option

  • Save mculp/3213944 to your computer and use it in GitHub Desktop.

Select an option

Save mculp/3213944 to your computer and use it in GitHub Desktop.
# link_to 'profile', new_or_edit_path(@profile)
def new_or_edit_path(resource)
resource_name = resource.class.name.underscore
resource ? __send__("edit_#{resource_name}_path", resource) : __send__("new_#{resource_name}_path")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment