更新country_state_select gem

时间:2016-11-05 09:15:14

标签: ruby-on-rails ruby ruby-on-rails-3 rubygems

我想更新country_state_select gem ...

这是我的Gemfile

gem 'country_state_select'
gem 'chosen_rails'
gem 'compass-rails'

bundle之后,我将启动我的rails应用程序rails s

我有错误,看起来像是

NoMethodError - undefined method `state_options' for CountryStateSelect:Module:
  app/views/shared/users/_light_box_login.html.erb:101:in `block in _app_views_shared_users__light_box_login_html_erb___390633241__632173138'
  actionview (4.2.7.1) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
  actionview (4.2.7.1) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer'
  actionview (4.2.7.1) lib/action_view/helpers/capture_helper.rb:38:in `capture'
  actionview (4.2.7.1) lib/action_view/helpers/form_helper.rb:444:in `form_for'
  simple_form (3.3.1) lib/simple_form/action_view_extensions/form_helper.rb:26:in `block in simple_form_for'
  simple_form (3.3.1) lib/simple_form/action_view_extensions/form_helper.rb:45:in `with_simple_form_field_error_proc'
  simple_form (3.3.1) lib/simple_form/action_view_extensions/form_helper.rb:25:in `simple_form_for'
  app/views/shared/users/_light_box_login.html.erb:44:in `_app_views_shared_users__light_box_login_html_erb___390633241__632173138'
  actionview (4.2.7.1) lib/action_view/template.rb:145:in `block in render'

我找到了solution

我的意思是gem 'country_state_select', '3.0.1'

但是当添加这个gem和bundle时,我还有另一个问题..

Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "compass-rails":
  In snapshot (Gemfile.lock):
    compass-rails (= 3.0.2)

  In Gemfile:
    compass-rails

    country_state_select (= 3.0.1) was resolved to 3.0.1, which depends on
      compass-rails (~> 2.0.4)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

任何人都帮助我..如何更新宝石版..

2 个答案:

答案 0 :(得分:0)

删除gemfile.lock文件并在gemfile中使用gem 'country_state_select',然后在终端中使用bundle install

答案 1 :(得分:0)

试试bundle update。这已经在你的问题中了。

或者,如果您想更新特定的宝石用途,

bundle update gem-name