C
C
ctl2017-07-17 22:19:40
Ruby on Rails
ctl, 2017-07-17 22:19:40

How to execute a couple of queries in ActiveRecord after submitting the form?

Will this work?


Logs = Logs.new(log_params)
Users.find(current_user.id).update(money: Users.find(current_user.id)['money'] - params[:money]) // and so on

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Demidenko, 2017-07-18
@ctl

current_user.decrement!(:money, params[:money])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question