Just playing around with a simple rails app with only one model that I have scaffolded just for this project.
Inside a search_form_for, I have a <%= f.label :name_cont %> and <%= f.text_field :name_cont%> -- basically as per RailsCasts and the ReadMe.
I get undefined method name' for nil:NilClass error. My model does have a name column and the <%= sort_link(@q, :name, "Name") %> filter works fine.
I run Ruby 2.2.0, Rails 4.2.0, and Ransack 1.7.0.
Any ideas? Thanks.
Hi @AnnaErshova, could you please provide the information needed to reproduce your exact issue? Please see the Contributing Guide. So far, it looks more like a bug in your code than with Ransack, but I'll re-open this and have a look when you've given enough info to reproduce it. OK? Thanks :smiley:
@jonatack I did fix it, but I think it was something with Ransack. It went away after I updated command tools I think (that was a while back). Just keep an eye out for it if someone else reports it. Thanks!
Just noticed that occurs after @search.build_condition call.
E.g.
@search = model.search(params[:q])
@search.name_cont # ok
@search.build_condition
@search.name_cont # raises nil pointer error
Most helpful comment
Just noticed that occurs after
@search.build_conditioncall.E.g.