Rails: activeadmin overriding create action

后端 未结 4 1088
渐次进展
渐次进展 2021-01-30 12:34

I have an activeadmin resource which has a belongs_to :user relationship.

When I create a new Instance of the model in active admin, I want to associate the currently lo

4条回答
  •  日久生厌
    2021-01-30 13:10

    Another option:

    def create
      params[:item].merge!({ user_id: current_curator.id })
      create!
    end
    

提交回复
热议问题