Ruby on Rails: params is nil. undefined method `[]' for nil:NilClass

后端 未结 1 731
梦如初夏
梦如初夏 2021-01-07 03:06

I am getting an error when trying to access a search page I have made. The problem seems to be that I am trying to remove blanks when there aren\'t any there. My search func

相关标签:
1条回答
  • 2021-01-07 04:02

    your problem is that params[:technols] is nil and you're trying to retrieve value of id key from a nil object. You need to instead do -

    tech_ids = params[:technols][:id].reject(&:blank?) unless params[:technols].nil?
    
    0 讨论(0)
提交回复
热议问题