RailsCasts Pro episodes are now free!

Learn more or hide this

Krishna Srihari's Profile

GitHub User: krishnasrihari

Site: www.masymbol.com

Comments by Krishna Srihari

Avatar

You may get this error in Rails 3.2

N+1 Query detected
Country => [:states]
Add to your finder: :include => [:states]
N+1 Query method call stack

Add includes to Country as below

<%= pf.grouped_collection_select :state_id, Country.includes(:states).order(:name), :states, :name, :id, :name, include_blank: true %>