使用 rails-simple-search 这个 gemhttps://github.com/yzhanginwa/rails-simple-search
用作搜索,但是在 rails 4.2 报错,出现一下错误:
NoMethodError - undefined method `param_key' for nil:NilClass:
actionview (4.2.0) lib/action_view/helpers/form_helper.rb:433:in `form_for'
应该是这里出问题
@search = Search.new(User, params[:search])
<% form_for @search, url => "/xxxxxx" do |f| %>
在 google 搜索过, http://stackoverflow.com/questions/27429276/rails-4-and-form-for-undefined-method-param-key-for-nilnilclass
Hey I figured it out.. Style belongs to :model which is throwing an error because of some .model_name stuff in Rails 4 .. That was a poor choice for a model name! Now to rewrite my db, model, controllers, views, etc
但是我不知道具体问题出现在他代码哪里?要怎么修改? 请教大家!