examples/bank/app/controllers/transfers_controller.rb in command_model-2.0.1 vs examples/bank/app/controllers/transfers_controller.rb in command_model-2.1.0
- old
+ new
@@ -1,15 +1,15 @@
class TransfersController < ApplicationController
def new
@accounts = Account.all
@transfer = Account::Transfer.new
end
-
+
def create
@transfer = Account::Transfer.new(params[:transfer])
-
+
if @transfer.call.success?
- redirect_to root_path, :notice => "Transferred #{@transfer.amount} from #{@transfer.from.name}'s account to #{@transfer.to.name}'s account."
+ redirect_to root_path, notice: "Transferred #{@transfer.amount} from #{@transfer.from.name}'s account to #{@transfer.to.name}'s account."
else
@accounts = Account.all
render :new
end
end