0

风景如画

有两种模型,一种是业务,另一种是业务提交。

&关系是业务属于_到业务_提交。具有 business_submission_id 的业务表。

现在有一种业务形式,我们可以在其中编辑 business_submission 表单代码类似于

  = simple_form_for @business, url: business_path(@business), method: :put, html: { autocomplete: "off" }  do |f|
   = f.simple_fields_for :business_submission, @submission do |submission|

&参数是

 Processing by BusinessesController#update as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"AShWrN/jyx6BlLIVAEXYK5j8IqDcWIEy1xyBsVrlw/C6Km/pvq6giHoNO2SaAlwHVe 
   pqV1BqMCvQgH3cO50ssA==", "business"=>{"business_submission_attributes"=> 
   {"serve_okra"=>"0", "years_in_operation"=>"", "perc_blck_owned"=>"", 
   "perc_women_owned"=>"", "perc_veteran_owned"=>"", "bev_provider"=>"", 
   "liq_lisence"=>"0", "liquor_distributor"=>"", "beer_wine_lisence"=>"0", 
   "sell_food_or_bev"=>"0", "setup_w_del_serv"=>"0", "need_website"=>"1", 
   "help_social_media_channel"=>"0", "need_photography"=>"0", 
   "business_relief_resources"=>"0", "which_pos_system"=>"", "here_about_us"=>"", 
   "extra_help"=>"", "id"=>"23"}, "live"=>"0", "temporarily_closed"=>"0"

但是当调用 @business.update(_business_params.merge(last_updated_by_id: current_user.id)) 然后得到 Record not found 错误 Business Submission with this id not found ...

4

0 回答 0