Move macro to class level

This commit is contained in:
Rafael Mendonça França 2013-10-09 20:17:59 -03:00
parent 3c27b6ee7e
commit a929d78d7b
4 changed files with 5 additions and 5 deletions

@ -53,10 +53,10 @@ def initialize(name, scope, options, extension)
end
def build(model)
ActiveRecord::Reflection.create(macro, name, scope, options, model)
ActiveRecord::Reflection.create(self.class.macro, name, scope, options, model)
end
def macro
def self.macro
raise NotImplementedError
end

@ -1,6 +1,6 @@
module ActiveRecord::Associations::Builder
class BelongsTo < SingularAssociation #:nodoc:
def macro
def self.macro
:belongs_to
end

@ -1,6 +1,6 @@
module ActiveRecord::Associations::Builder
class HasMany < CollectionAssociation #:nodoc:
def macro
def self.macro
:has_many
end

@ -1,6 +1,6 @@
module ActiveRecord::Associations::Builder
class HasOne < SingularAssociation #:nodoc:
def macro
def self.macro
:has_one
end