emaglio / blog

Our new Trailblazer sample app
6 stars 3 forks source link

Replace options["result.validate"] with simple boolean #35

Closed emaglio closed 7 years ago

emaglio commented 7 years ago

if a step return false the flow is moving to the fail pipe

class BlogPost::New < Trailblazer::Operation 
  step Policy::Guard( :authorize! )
  step Model ( BlogPost, :new ) 
  step Contract::Build( constant: BlogPost::Contract::Create )

  def authorize!(options, current_user:, **)
    current_user.signed_in?
  end 
end