Rails How to pass params from controller to after_save inside model

前端 未结 3 1388
有刺的猬
有刺的猬 2021-01-06 08:10

I have a Rfq contoller i am creating new or updating existing Rfqs, when i create or update the object is saved, what i want is as i have number of quotes params i want to u

3条回答
  •  情话喂你
    2021-01-06 08:47

    Honestly if it deals with params, it's probably a good idea to put that type of logic in the controller, lest you muddle the responsibilities of the model and controller.

    That is, in the controller:

    if @foo.save
      # Update line_items using params[:quotes]
    end

提交回复
热议问题