While upgrading an application from Rails 3.2 to Rails 4.2.8, ruby version has remained the same at 2.3.2. Bundle install and bundle update are running successfully with no warnings or errors.
Environment: windows, ruby 2.3.2
Performing any rake tasks or starting of server breaks, find the errors below,
Rake task breaks:
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 start throws error:
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)
I have tried multiple versions of Formtastic gem which could not resolve the issue even going down to 2.0 version. Let me know if any patches or fixes around this is available.
Update: Including the error stack trace of rake failure
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>'
The error points to the below file and the buttonhelper call.
.....
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
.....
It seems like you use formtastic
and the formtastic-bootstrap
gem. Unfortunately formtastic-bootstrap
is not compatible with current formtastic
versions, furthermore it seems unmaintained, because it didn't receive any updates during the last two years.
I see two options:
formtastic
~> 2.1.1
like mentioned in this answer. formtastic-bootstrap
to be able to move forwards.I would choose the second option. Using an old software stack just because it depends on a gem (that seems to be abandoned anyway) doesn't sound like a good plan to me.