rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.08k stars 161 forks source link

[changeset] support for command options and plugins #558

Closed solnic closed 5 years ago

solnic commented 5 years ago

This adds support for configuring changeset commands using command_options and command_plugins class settings.

Here's what will be possible with this feature:

module TimestampPlugin
  def self.apply(klass, options)
    klass.command_plugins :timestamps, timestamps: options
  end
end

ROM::Plugins.register(:timestamp, TimestampPlugin, type: :changeset)

class CreateChangeset < ROM::Changeset::Create
  use :timestamps, [:created_at]
end