lib/attachs/builder.rb in attachs-4.0.0.4 vs lib/attachs/builder.rb in attachs-4.0.0.5

- old
+ new

@@ -37,11 +37,11 @@ define_method attribute do variable = "@#{attribute}" if instance = instance_variable_get(variable) instance else - if options[:multiple] == true + if options[:multiple] klass = Attachs::Collection else klass = Attachs::Attachment end instance_variable_set( @@ -54,10 +54,10 @@ end def define_attributes_writer(attribute, options) concern.class_eval do define_method "#{attribute}_attributes=" do |collection_or_attributes| - if options[:multiple] == true + if options[:multiple] collection_or_attributes.each do |attributes| if id = attributes.delete(:id) attachment = send(attribute).find(id) else attachment = send(attribute).new