Skip to content

Instantly share code, notes, and snippets.

@jesscanady
Created November 4, 2010 14:39
Show Gist options
  • Save jesscanady/662545 to your computer and use it in GitHub Desktop.
Save jesscanady/662545 to your computer and use it in GitHub Desktop.
Example of the delegate method
class Authorship < ActiveRecord::Base
belongs_to :author
belongs_to :book
delegate :full_name, :to => :author
end
# > @authorship.full_name now calls @authorship.author.full_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment