lib/alba/resource.rb in alba-0.11.1 vs lib/alba/resource.rb in alba-0.12.0
- old
+ new
@@ -139,10 +139,11 @@
# @param block [Block]
# @see Alba::One#initialize
def one(name, condition = nil, resource: nil, key: nil, &block)
@_attributes[key&.to_sym || name.to_sym] = One.new(name: name, condition: condition, resource: resource, &block)
end
+ alias has_one one
# Set Many association
#
# @param name [String, Symbol]
# @param condition [Proc]
@@ -151,9 +152,10 @@
# @param block [Block]
# @see Alba::Many#initialize
def many(name, condition = nil, resource: nil, key: nil, &block)
@_attributes[key&.to_sym || name.to_sym] = Many.new(name: name, condition: condition, resource: resource, &block)
end
+ alias has_many many
# Set serializer for the resource
#
# @param name [Alba::Serializer]
def serializer(name)