Last active
January 20, 2016 00:34
-
-
Save robwilliams/a99ec5a4cb63fcbd4566 to your computer and use it in GitHub Desktop.
Alternative block syntax for operations in Trailblazer
This file contains hidden or 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
# 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