lib/zendesk_api/collection.rb in zendesk_api-1.10.0 vs lib/zendesk_api/collection.rb in zendesk_api-1.11.0

- old
+ new

@@ -45,23 +45,23 @@ @fetchable = true end end # Methods that take a Hash argument - methods = %w{create find update destroy} + methods = %w{create find update update_many destroy} methods += methods.map {|method| method + "!"} methods.each do |deferrable| # Passes arguments and the proper path to the resource class method. # @param [Hash] options Options or attributes to pass define_method deferrable do |*args| unless @resource_class.respond_to?(deferrable) raise NoMethodError.new("undefined method \"#{deferrable}\" for #{@resource_class}", deferrable, args) end - opts = args.last.is_a?(Hash) ? args.pop : {} - opts.merge!(:association => @association) + args << {} unless args.last.is_a?(Hash) + args.last.merge!(:association => @association) - @resource_class.send(deferrable, @client, opts) + @resource_class.send(deferrable, @client, *args) end end # Methods that take an Array argument methods = %w{create_many! destroy_many!}