Skip to content

Instantly share code, notes, and snippets.

@rich
Created August 22, 2008 03:33
Show Gist options
  • Select an option

  • Save rich/6733 to your computer and use it in GitHub Desktop.

Select an option

Save rich/6733 to your computer and use it in GitHub Desktop.
class Author < ActiveRecord::Base
has_many :books do
def correct
map {|b| b.name}
end
def broken
proxy_target.map {|b| b.name}
end
end
end
Author.first.books.broken # => []
Author.first.books.correct # => ["One", "Two"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment