0

Beim Aktualisieren einer Anwendung von Rails 3.2 auf Rails 4.2.8 ist die Ruby-Version bei 2.3.2 unverändert geblieben. Bundle-Installation und Bundle-Update werden erfolgreich ohne Warnungen oder Fehler ausgeführt.Probleme mit Formtastic Gem bei Upgrade von Rails 4

Umwelt: Fenster, Rubin 2.3.2

Performing alle Rake Aufgaben oder der Server bricht starten, die Fehler unten finden,

Rake Aufgabe Pausen:

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' 

Development Server Startwürfe Fehler:

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) 

Ich habe mehrere Versionen von Formtastic gem versucht, die das Problem sogar hinunter in Version 2.0 nicht lösen können. Lassen Sie mich wissen, ob Patches oder Fixes verfügbar sind.

aktualisieren: Einschließlich der Fehler-Stack-Trace von Rake Ausfall

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

Die Fehler verweist auf die unter Datei und der buttonhelper Anruf.

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

Antwort

1

Es scheint, wie Sie formtastic und die formtastic-bootstrap gem verwenden. Leider ist formtastic-bootstrap nicht kompatibel mit aktuellen formtastic Versionen, außerdem scheint es nicht gepflegt zu sein, da es in den letzten zwei Jahren keine Updates erhalten hat.

Ich sehe zwei Möglichkeiten:

  1. Herunterstufung zu formtastic~> 2.1.1 wie in this answer erwähnt.
  2. Ersetzen oder Gabel und fixieren Sie die formtastic-bootstrap, um vorwärts zu bewegen.

Ich würde die zweite Option wählen. Einen alten Software-Stack zu verwenden, nur weil er von einem Juwel abhängt (das scheint sowieso aufgegeben zu werden) klingt für mich nicht nach einem guten Plan.

+0

Ich hatte diese Antwort gesehen, aber ich benutze formtastic-bootstrap gem nicht. Ich benutze Bootstrap nach dem Einschließen der zugehörigen Dateien in meinem Projektordner. Gemfile.lock zeigt formtastic hängt nur von actionpack ab, wie ich in qsn erwähnt habe. – Bijendra

+0

Die Fehlermeldung besagt, dass Sie 'formtastic/helpers/buttons_helper' irgendwo in Ihrem Code (direkt oder in einem Juwel) benötigen. Dieses Modul existiert in neueren Versionen von 'formtastic' nicht mehr. Bitte posten Sie die Datei, wenn Sie diesen Helfer benötigen oder benennen Sie den Edelstein, der sie benötigt (oder veröffentlichen Sie Ihre Gemfile.lock). – spickermann

+0

Ich aktualisierte mein QSN mit Fehler-Stack-Trace, der auf die Referenzen zeigt. Es wurde von formtastic.rb aufgerufen, ich hatte die depreciation Nachricht auf der github Seite gesehen, aber wundere mich, warum die Referenz noch im gem code – Bijendra

Verwandte Themen