Skip to content

Instantly share code, notes, and snippets.

@rickenharp
Created May 17, 2016 07:18
Show Gist options
  • Save rickenharp/26742a4a4dd8a62176d58c26271b6690 to your computer and use it in GitHub Desktop.
Save rickenharp/26742a4a4dd8a62176d58c26271b6690 to your computer and use it in GitHub Desktop.
require 'disposable/twin/struct'
require 'trailblazer/operation/model'
require 'reform/form/dry'
module User
class Create < Trailblazer::Operation
include Model
model ::User::Persistence, :create
contract do
include Reform::Form::Dry
property :name
validation :default do
key(:name, &:filled?)
end
end
def process(params)
validate(params) do
model.save
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment