我桌面上有一个现有的ruby on rails项目(Moovit)。现在我想在我的linux上运行这个现有的项目。但我似乎无法运行它。我不知道我是否正确行事。我将它转移到我的根文件夹然后我运行此代码rails new Moovit -s
我不知道这是否正确?当我在浏览器上查看时,它无法正常工作。它说你好世界。 Moovit项目是一个网站。我遇到麻烦时创建了一个备份。我也去了Moovit文件夹然后rails s
,但它没有用。我也运行bundle install
但仍无效。我该怎么办?
信息:
Rails 3.2.1
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
捆绑show showactivesupport
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6
我跑的时候 捆绑安装
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
cd Moovit
rails -s
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `block in require': iconv will be deprecated in the future, use String#encode instead.
=> Booting WEBrick
=> Rails 3.0.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/root/Moovit/config/initializers/wrap_parameters.rb:8:in `block in <top (required)>': undefined method `wrap_parameters' for ActionController::Base:Class (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /root/Moovit/config/initializers/wrap_parameters.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:235:in `load'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:235:in `block in load'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:235:in `load'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/engine.rb:200:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:25:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:50:in `block in run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:49:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:134:in `initialize!'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/application.rb:77:in `method_missing'
from /root/Moovit/config/environment.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `require'
from /root/Moovit/config.ru:3:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:46:in `initialize'
from /root/Moovit/config.ru:1:in `new'
from /root/Moovit/config.ru:1:in `<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:35:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/builder.rb:35:in `parse_file'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/server.rb:162:in `app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/server.rb:248:in `wrapped_app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/server.rb:213:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands/server.rb:65:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:30:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我应该如何在我的特定IP地址上运行它?似乎在我的/ var / www / html /那里有一个表示hello world的index.html。我的ruby on rails项目在根文件夹上。我真的输了。我想当只是运行这些命令会使它可用于我的服务器?
答案 0 :(得分:3)
关注Bellow说明:
您还可以将哪个版本的rails用于项目。
请添加config / initializers / wrap_parameters.rb并重启服务器。
ActiveSupport.on_load(:action_controller) do
if self == ActionController::Base
wrap_parameters :format => [:json]
end
end
答案 1 :(得分:3)
转到/config/initializers/wrap_parameters.rb
,注释掉以前的代码并尝试使用此代码
ActiveSupport.on_load(:action_controller) do
include ActionController::ParamsWrapper
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end