表单数据不会保存在生产中

时间:2014-12-19 10:20:02

标签: ruby-on-rails ruby

我对rails应用程序有一个有趣的问题。我已从rails 3.2升级到rails 4.1

出于某种原因,我的VPS上不会处理一个特定的帖子'表单',而是在我提交的本地服务器上处理。

我模拟了我的生产服务器。它运行良好,但我仍然无法弄清楚它为什么不能保存在生产服务器上。

我的参数哈希是好的,它已提交,我的csrf令牌很好,但它不会被处理。有没有人经历过这样的事情?

这是我在我的控制器中的创建动作

conservtypes_controller.rb

def create

  selected_conservtypes = params[:conservtype][:conservice_id]
 #Rails.logger.debug "Printing the params hash here"  
 #raise  params.inspect
 #Rails.logger.debug "Params hash printed just above here"
 selections =[]
 selected_conservtypes.each{|sc| selections << {:undpuser_id => params[:conservtype][:undpuser_id],:conservice_id => sc,:consultant_id=>params[:conservtype][:consultant_id]} unless sc.empty?}
 selections.delete_if {|scn| Conservtype.count(:conditions => scn) > 0}

  if selections.size <= 0
    flash[:error] = 'You have already selected all the submitted services'
     puts params.inspect 
     #verify_user_section
  elsif Conservtype.create(selections)
    flash[:notice] = "Successfully selected Service(s)"
     verify_user_section
  else
    flash[:error] = 'Unable to add your selections '
      verify_user_section

  end

end

1 个答案:

答案 0 :(得分:0)

谢谢大家,我终于通过将rails gem从rails 4.1降级到rails 4.0来解决这个问题,一切正常。