RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: krishnasrihari
Site: www.masymbol.com
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 %>
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