Ruby on Rails 4.1.8
Spree 2.6-stable
でECサイトを作っていて、カートに商品をいれて次へ進むとエラーが発生
NoMethodError in Spree::Checkout#edit
Showing /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree-dcd415d3ea99/frontend/app/views/spree/address/_form.html.erb where line #38 raised:
undefined method `states' for nil:NilClass
インストールしたばかりなのになぜ..と思ったら
https://github.com/spree/spree/issues/1142
で議論されてましたので参考に
$ rake db:seed
loading ruby /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree-984ecbce1d91/core/db/default/spree/countries.rb
loading ruby /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree-984ecbce1d91/core/db/default/spree/roles.rb
loading ruby /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree-984ecbce1d91/core/db/default/spree/states.rb
loading ruby /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree-984ecbce1d91/core/db/default/spree/stores.rb
loading ruby /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree-984ecbce1d91/core/db/default/spree/zones.rb
loading ruby /home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree_auth_devise-0172d0450bef/db/default/users.rb
Admin user has already been previously created.
・・・
などとできあがる初期値を作ってやったら直りました
https://github.com/spree/spree/commit/9820b66bb8d11fc8826dbeead2c46bc1424b8efb
で直ったのかと思ったらだめみたいです