lib/superstore/associations/reflection.rb in superstore-2.4.4 vs lib/superstore/associations/reflection.rb in superstore-2.5.0
- old
+ new
@@ -16,11 +16,11 @@
when :has_many
Superstore::Associations::HasMany
when :has_one
Superstore::Associations::HasOne
end
-
+
end
def instance_variable_name
"@#{name}"
end
@@ -43,15 +43,21 @@
def polymorphic?
options[:polymorphic]
end
+ def belongs_to?; false; end
+
def class_name
@class_name ||= (options[:class_name] || name.to_s.classify)
end
+ def inverse_name
+ options[:inverse_of]
+ end
+
private
-
+
def derive_foreign_key
case macro
when :has_many, :has_one
model.name.foreign_key
when :belongs_to