Created
August 19, 2010 14:47
-
-
Save pollingj/538055 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice work