tb / northwind-graphql-ruby

Northwind graphql-ruby
http://northwind-graphql-ruby.herokuapp.com/
24 stars 4 forks source link

id = attributes.delete(@model.primary_key) #36

Open ghost opened 6 years ago

ghost commented 6 years ago

Why this:

id = attributes.delete(@model.primary_key) in:

  def call(_obj, args, _ctx)
      attributes = args[@param_key].to_h
      id = attributes.delete(@model.primary_key)
      record = @model.find(id)
      record.update!(Services::NestedAttributes.call(@model, attributes))
      record
    end

here: https://github.com/tb/northwind-graphql-ruby/blob/master/app/graphql/functions/update.rb ?

Is the .update! method in Rails chcking for id?