Created
May 17, 2016 07:18
-
-
Save rickenharp/26742a4a4dd8a62176d58c26271b6690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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