Skip to content

Instantly share code, notes, and snippets.

@robwilliams
Last active January 20, 2016 00:34
Show Gist options
  • Save robwilliams/a99ec5a4cb63fcbd4566 to your computer and use it in GitHub Desktop.
Save robwilliams/a99ec5a4cb63fcbd4566 to your computer and use it in GitHub Desktop.
Alternative block syntax for operations in Trailblazer
# original
def create
run Admin::Product::Create do |op|
redirect_to admin_product_path(op.model)
return
end
render :new
end
# alternative
def create
run Admin::Product::Create do |op|
success do
redirect_to admin_product_path(op.model)
end
failure do
render :new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment