0

アプリケーションをRails 3.2からRails 4.2.8にアップグレードする際、rubyのバージョンは2.3.2と同じです。バンドルのインストールとバンドルの更新は、警告またはエラーなしで正常に実行されています。Rails 4のアップグレードでのFormtastic Gemの問題

環境:窓、ルビー2.3.2

任意のすくいタスクを実行するか、サーバー切断の開始、以下のエラーを見つける、

rakeタスクブレイク:

Error:[rake --tasks] C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/cucumber-1.1.9/lib/cucumber/ast/feature_element.rb:52: warning: circular argument reference - name 
    rake aborted! 
    LoadError: cannot load such file -- formtastic/helpers/buttons_helper 
    C:/workspace/project1/lib/ext/gems/formtastic/formtastic.rb:13:in `<module:Formtastic>' 
    C:/workspace/project1/lib/ext/gems/formtastic/formtastic.rb:1:in `<top (required)>' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 

開発サーバースタートスローエラー:

C:/workspace/project1/lib/ext/gems/formtastic/formtastic.rb:13:in `<module:Formtastic>': cannot load such file -- formtastic/helpers/buttons_helper (LoadError) 
    from C:/workspace/projects/CosmoD2Upgrade/director2/lib/ext/gems/formtastic/formtastic.rb:1:in `<top (required)>' 
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require' 
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' 

Gemfile:

# form builder 
    gem 'formtastic' 

Gemfile.lock

formtastic (3.1.5) 
    actionpack (>= 3.2.13) 

私は問題もバージョン2.0に下がって解決できませんでしたFormtastic宝石の複数のバージョンを試してみました。この問題を回避するパッチや修正があるかどうか知らせてください。

更新

Error:[rake --tasks] C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/cucumber-1.1.9/lib/cucumber/ast/feature_element.rb:52: warning: circular argument reference - name 
    rake aborted! 
    LoadError: cannot load such file -- formtastic/helpers/buttons_helper 
    C:/workspace/project/lib/ext/gems/formtastic/formtastic.rb:13:in `<module:Formtastic>' 
    C:/workspace/project/lib/ext/gems/formtastic/formtastic.rb:1:in `<top (required)>' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require' 
    C:/workspace/project/config/application.rb:9:in `block in <top (required)>' 
    C:/workspace/project/config/application.rb:9:in `each' 
    C:/workspace/project/config/application.rb:9:in `<top (required)>' 
    C:/workspace/project/Rakefile:4:in `require' 
    C:/workspace/project2/Rakefile:4:in `<top (required)>' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/rake_module.rb:28:in `load' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/rake_module.rb:28:in `load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:686:in `raw_load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:96:in `block in load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:95:in `load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:79:in `block in run' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:77:in `run' 
    C:/workspace/project/bin/rake:4:in `<main>' 
    Polyglot::PolyglotLoadError: Failed to load C:/workspace/project/lib/ext/gems/formtastic/formtastic.rb using extensions rb, treetop, tt 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:55:in `load' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:68:in `rescue in require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require' 
    C:/workspace/project/config/application.rb:9:in `block in <top (required)>' 
    C:/workspace/project/config/application.rb:9:in `each' 
    C:/workspace/project/config/application.rb:9:in `<top (required)>' 
    C:/workspace/project/Rakefile:4:in `require' 
    C:/workspace/project/Rakefile:4:in `<top (required)>' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/rake_module.rb:28:in `load' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/rake_module.rb:28:in `load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:686:in `raw_load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:96:in `block in load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:95:in `load_rakefile' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:79:in `block in run' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling' 
    C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:77:in `run' 
    C:/workspace/projects/bin/rake:4:in `<main>' 

エラーポイント以下のファイルにすくい失敗のエラースタックトレースとbuttonhelperコールを含みます。

..... 
    Line no 13: 
    module Helpers::ButtonsHelper 
     def commit_button(*args) 
     options = args.extract_options! 
     text = options.delete(:label) || args.shift 

     text = (localized_string(commit_button_i18n_key, text, :action, :model => commit_button_object_name) || 
      Formtastic::I18n.t(commit_button_i18n_key, :model => commit_button_object_name)) unless text.is_a?(::String) 

     button_html = options.delete(:button_html) || {} 
     button_html.merge!(:class => [button_html[:class], commit_button_i18n_key].compact.join(' ')) 

     wrapper_html = options.delete(:wrapper_html) || {} 
     wrapper_html[:class] = (commit_button_wrapper_html_class << wrapper_html[:class]).flatten.compact.join(' ') 

     accesskey = (options.delete(:accesskey) || default_commit_button_accesskey) unless button_html.has_key?(:accesskey) 
     button_html = button_html.merge(:accesskey => accesskey) if accesskey 

     Formtastic::Util.html_safe(submit(text, button_html)) 
     end 
    end 
    ..... 

答えて

1

あなたはformtasticformtastic-bootstrap宝石を使用するように思えます。残念ながらformtastic-bootstrapは現在のformtasticと互換性がありません。また、過去2年間に更新されていないため、維持されていないようです。 this answerで述べたように

  1. ダウングレード~> 2.1.1formtasticへ:

    は、私は2つのオプションを参照してください。

  2. formtastic-bootstrapを交換またはフォークして前方に移動できるように修正します。

私は2番目のオプションを選択します。古いソフトウェアスタックを使っているのは、それが捨てられていると思われる宝石に依存しているからといって、私にとって良い計画のようには聞こえません。

+0

私はその答えを見ましたが、私はformtastic-bootstrap gemを使用していません。私は、プロジェクトフォルダに関連するファイルを含めた後にブートストラップを使用しています。 Gemfile.lockは、formtasticがqsnで言及したようにアクションパックにのみ依存することを示しています。 – Bijendra

+0

エラーメッセージは、コードのどこか(直接的にも宝石類でも) 'formtastic/helpers/buttons_helper'が必要であることを示しています。そのモジュールは、新しいバージョンの 'formtastic'ではもう存在しません。そのヘルパーを必要とするファイルを投稿するか、それを必要とする宝石の名前をつけてください(またはあなたのGemfile.lockを投稿してください)。 – spickermann

+0

私はqsnを参照を指すエラースタックトレースで更新しました。これはformtastic.rbから呼び出されています。githubページの非推奨メッセージも見たことがありますが、参照がまだ宝石コードに残っているのはなぜですか? – Bijendra

関連する問題