Move macro to class level
This commit is contained in:
parent
3c27b6ee7e
commit
a929d78d7b
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user