【发布时间】:2018-07-06 09:17:41
【问题描述】:
在我的 Rails 5 应用程序中,我试图在控制器中执行此操作:
def create
company_params = params.require(:company).permit(
:name,
:email,
:people_attributes => [
:first_name,
:last_name
]
).deep_merge(
:creator_id => current_user.id,
:people_attributes => [
:creator_id => current_user.id
]
)
@company = current_account.companies.build(company_params)
if @company.save
flash[:success] = "Company created."
redirect_to companies_path
else
render :new
end
end
由于某种原因,我收到了这个错误:
ActionController::Parameters:0x007fa24c39cfb0 的未定义方法 `deep_merge'
我在这里错过了什么?
【问题讨论】:
标签: ruby-on-rails ruby actioncontroller