Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pollingj/538055 to your computer and use it in GitHub Desktop.
Save pollingj/538055 to your computer and use it in GitHub Desktop.
InheritedResources::BaseHelpers.module_eval do
def resource
get_resource_ivar || end_of_association_chain.respond_to?('by_slug') ? set_resource_ivar(end_of_association_chain.by_slug(params[:id])) : set_resource_ivar(end_of_association_chain.find(params[:id]))
end
def collection
get_collection_ivar || set_collection_ivar(end_of_association_chain.all)
end
end
@davetheninja
Copy link

nice work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment