Guest User

Untitled

a guest
Dec 9th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. def create
  2. params[:account][:officer_id] =
  3. current_user.id if !current_user.nil? && current_user.role?(:comercial)
  4. if Account.exists_without_info?(params[:account])
  5. #buscar contas
  6. account.update_attributes(params[:account])
  7. redirect_to new_account_client_info_path(@account.id) and return
  8. else
  9. @account = Account.new(params[:account]).build
  10. if @account.save
  11. AccountMailer.registration(@account).deliver
  12. redirect_to new_account_client_info_path(@account.id)
  13. else
  14. flash.now[:error] = @account.errors.full_messages
  15. render action: "new"
  16. end
  17. end
  18. end
Add Comment
Please, Sign In to add comment