Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create
- params[:account][:officer_id] =
- current_user.id if !current_user.nil? && current_user.role?(:comercial)
- if Account.exists_without_info?(params[:account])
- #buscar contas
- account.update_attributes(params[:account])
- redirect_to new_account_client_info_path(@account.id) and return
- else
- @account = Account.new(params[:account]).build
- if @account.save
- AccountMailer.registration(@account).deliver
- redirect_to new_account_client_info_path(@account.id)
- else
- flash.now[:error] = @account.errors.full_messages
- render action: "new"
- end
- end
- end
Add Comment
Please, Sign In to add comment