lib/alba/one.rb in alba-0.9.0 vs lib/alba/one.rb in alba-0.10.0

- old
+ new

@@ -1,12 +1,12 @@ require 'alba/association' module Alba # Representing one association class One < Association - def to_hash(target) + def to_hash(target, params: {}) object = target.public_send(@name) - @resource ||= resource_class - @resource.new(object).to_hash + object = @condition.call(object) if @condition + @resource.new(object, params: params).to_hash end end end