2016-11-05 71 views
0

我想更新country_state_select寶石...更新country_state_select寶石

這是我的Gemfile

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

而且bundle後,我將開始我的Rails應用程序rails s

我有錯誤,它看ilke

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'

但是,當添加此寶石和包,我還有一個問題..

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. 

任何幫助me..how到更新版本的寶石..

回答

0

嘗試bundle update。這已經是你的問題了。

或者,如果你想更新特定的寶石使用,

bundle update gem-name 
+0

它仍然country_state_select(2.0.0) –

+0

我想country_state_select(3.0.1) –

+0

不要指定版本號作爲country_state_select gem使用3.0.2現在默認和最新版本。將Gem'country_state_select','3.0.1'更改爲Gem'country_state_select',然後運行'bundle install'。如果它仍然不起作用,請嘗試「更新包更新country_state_select」 –

0

刪除gemfile.lock文件並在您的gemfile中使用gem 'country_state_select',然後在終端中使用bundle install

+0

確定,但defult版本country_state_select(2.0.0).....我想country_state_select(3.0.1) –

+0

我已經更新了答案,希望它會有所幫助。 –