Module: ROM::Changeset::Restricted

Included in:
Delete, Update
Defined in:
lib/rom/repository/changeset/restricted.rb

Instance Method Summary collapse

Instance Method Details

#by_pk(pk, data = EMPTY_HASH) ⇒ Changeset

Restrict changeset’s relation by its PK

Examples:

repo.changeset(UpdateUser).by_pk(1).data(name: "Jane")

Parameters:

  • pk (Object)

Returns:



23
24
25
# File 'lib/rom/repository/changeset/restricted.rb', line 23

def by_pk(pk, data = EMPTY_HASH)
  new(relation.by_pk(pk), __data__: data)
end

#commandObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a command restricted by the changeset’s relation



9
10
11
# File 'lib/rom/repository/changeset/restricted.rb', line 9

def command
  super.new(relation)
end