Skip to content

Instantly share code, notes, and snippets.

@guilherme
Created July 3, 2012 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilherme/3040154 to your computer and use it in GitHub Desktop.
Save guilherme/3040154 to your computer and use it in GitHub Desktop.
ar: reflections inheritance
require 'active_record'
class ModelA < ActiveRecord::Base
end
class SubModelA < ModelA
end
p SubModelA.reflections.keys
class OtherModel < ActiveRecord::Base
end
ModelA.has_many :other_models
p ModelA.reflections.keys
p SubModelA.reflections.keys
# Output
[]
[:other_models]
[:other_models]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment