Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created March 19, 2009 00:34
Show Gist options
  • Save dchelimsky/81505 to your computer and use it in GitHub Desktop.
Save dchelimsky/81505 to your computer and use it in GitHub Desktop.
def site_with_recursive_search
site_without_recursive_search || parent.site
end
alias_method_chain :site, :recursive_search
OR
alias_method :site_without_recursive_search, :site
def site_with_recursive_search
site_without_recursive_search || parent.site
end
alias_method :site, :site_with_recursive_search
site = Site.make
root = AssetFolder.make(:title => 'root', :site => site)
child = AssetFolder.make(:title => 'child', :parent => root)
grandchild = AssetFolder.make(:title => 'grandchild', :parent => child)
grandchild.site.should == site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment