I am trying to deploy my Rails3.0 application on production server. There was many troubles before, but all of them solved. And now I have another.
There is a passenger error page's text:
Error message: uninitialized constant Formtastic::FormBuilder
Exception class: NameError
Backtrace:
0 /home/ubuntu/.rvm/gems/ruby-1.9.2-p180@rails3.0/gems/client_side_validations-3.1.0/lib/client_side_validations/formtastic.rb 20 in `'
1 /home/ubuntu/projects/questroad/config/initializers/client_side_validations.rb 4 in '
2 /home/ubuntu/.rvm/gems/ruby-1.9.2-p180@rails3.0/gems/railties-3.0.7/lib/rails/engine.rb 201 in
block (2 levels) in '
3 /home/ubuntu/.rvm/gems/r开发者_开发知识库uby-1.9.2-p180@rails3.0/gems/railties-3.0.7/lib/rails/engine.rb 200 in `each'
...
Google search results not helped me, and now I am here.
UPD: Also if i try to run WEBrick server there was the same error.
UPD: I try to comment "gem 'client_side_validation'" line in Gemfile, and error is disappeared. But now i cant use this gem.
I experience the same issue but not on the production, i got this error in the development after doing a:
bundle update
and then try to run my rspecs.
It seems that bundle update, installed client_side_validations 3.1.0 which seems to make problems ( ... not sure why, I don't have the time to analyze it atm), however using a fixed version in the Gemfile solved it:
gem 'client_side_validations', '3.0.5'
hope it helps!
This happening because you have Formtastic 1.x installed. The 3.1.x version of ClientSideValidations expects Formtastic 2.
Check if you have formtastic gem installed.
Also run this on production machine
bundle install --deployment
As this will install all the gems to location which passenger can find. Sometimes, it happens that passenger can't find the gem paths.
I don't know if you have follow this process but i recomand you to wrap your passenger with your gemset and start with RVM for independent passenger mode
rvm wrapper ruby-1.9.2-p180@rails3.0 passenger
and for start for example like this :
rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.2-p180@rails3.0' -c \
'cd /<your app PATH>/current/ && bundle exec passenger start -a 127.0.0.1 -p 3000 -d
精彩评论