Sign in through GitHub

Please read for an updated status on RailsCasts:

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 %>