Skip to content

Instantly share code, notes, and snippets.

@liangzan
Created September 5, 2010 02:58
Show Gist options
  • Save liangzan/565695 to your computer and use it in GitHub Desktop.
Save liangzan/565695 to your computer and use it in GitHub Desktop.
class Child < ActiveRecord::Base
belongs_to :parent
end
# rails console
>> Child.reflect_on_all_associations
Child.reflect_on_all_associations
=> [#<ActiveRecord::Reflection::AssociationReflection:0xb4828958
@options={},
@collection=false,
@name=:parent,
@active_record=Child(id: integer, name: string, parent_id: integer),
@macro=:belongs_to>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment