Rails 4仅在生产中受保护的属性

时间:2014-12-01 07:36:17

标签: ruby-on-rails ruby ruby-on-rails-4 strong-parameters

我有一个曾经是3.2应用程序的Rails 4.1应用程序。在稳定升级应用程序的过程中,我最初使用了protected_attributes gem。我现在已经移除了这个宝石,并指定了正确的许可证,如下所示:

def step_params
  params.require(:step).permit(:display_order, :name, :stepable_id, :stepable_type, :step_type, :image,
                               :image_cache, :image_temp_upload_url, :image_processed,
                               video_attributes: [:description, :video, :video_cache, :video_temp_upload_url],
                               download_attributes: [ :description, :download, :download_cache, :temp_upload_download_url],
                               quiz_attributes: [:description,
                                                 questions_attributes: [:question, :quiz_id,
                                                                        answers_attributes: [:answer, :correct, :question_id]
                                                ]
                                ],
                               reading_attributes: [:reading],
                               slidedeck_attributes: [:description, :slides, :audio, :audio_cache, :audio_temp_upload_url, :audio_duration,
                                                      slides_attributes: [:slide, :slide_cache, :slide_temp_upload_url, :slide_processed, :time]
                                ],
                               voice_over_attributes: [:image, :image_cache, :image_temp_upload_url, :image_processed, :audio, :audio_cache, :audio_temp_upload_url, :audio_duration]
                              )

end

这一切都在开发中完美运作。但是在制作中我遇到了这个错误:

  Parameters: {"authenticity_token"=>"...=", "step"=>{"name"=>"asdfasdgasfd", "image_temp_upload_url"=>"...", "image_cache"=>"", "stepable_type"=>"Download", "download_attributes"=>{"description"=>"asdasd", "temp_upload_download_url"=>"...", "download_cache"=>""}}, "commit"=>"Save", "subdomain"=>"my", "author_id"=>"61"}
WARNING: Can't mass-assign protected attributes for Step: name, stepable_type, image_cache, image_temp_upload_url, download_attributes
    app/controllers/my/author/steps_author_controller.rb:17:in `create'

有什么我忘记删除或???提前谢谢。

0 个答案:

没有答案