Sha256: ad23e9761923ee177fb3d391859f940b4693378b115400239cd98e7f44997c22

Contents?: true

Size: 529 Bytes

Versions: 10

Compression:

Stored size: 529 Bytes

Contents

# frozen_string_literal: true

module LunaPark
  module Extensions
    module Repositories
      module Postgres
        module Update
          def save(input)
            entity = wrap(input)
            entity.updated_at = Time.now.utc
            row = to_row(entity)
            new_row = dataset.returning.where(primary_key => row[primary_key]).update(row).first
            new_attrs = from_row(new_row)
            entity.set_attributes(new_attrs)
            entity
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
luna_park-0.12.1 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.12.0 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.7 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.6 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.5 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.4 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.3 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.2 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.1 lib/luna_park/extensions/repositories/postgres/update.rb
luna_park-0.11.0 lib/luna_park/extensions/repositories/postgres/update.rb