简体   繁体   中英

How to run existing ruby on rails project in linux

I have an existing ruby on rails project on my desktop (Moovit). now i want to run this existing project on my linux. but i can't seem to run it. i dont know if im doing it right. i transferred it to my root folder then i run this code rails new Moovit -s i dont know if this is correct? It's not working and when i checked on my browser. it says hello world . the Moovit project is a website. I've created a backup in case of trouble. I also go to Moovit folder then rails s but it's not working. I also run bundle install but still not working. How should I do it?

info:

Rails 3.2.1
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]

bundle show activesupport

/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6

when i run bundle install

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

also how should i run it on my specific ip address? it seems that on my /var/www/html/ there's an index.html which says hello world. and my ruby on rails project is on root folder. I'm really lost. I thought when just running those commands will make it available to my server?

Follow Bellow Instruction:

  1. cd project_name
  2. bundle install
  3. rails s

Also which version of rails do you use for project.

Please add config/initializers/wrap_parameters.rb and the restart your server.

ActiveSupport.on_load(:action_controller) do
  if self == ActionController::Base
    wrap_parameters :format => [:json]
  end
end

Go to /config/initializers/wrap_parameters.rb , comment out the previous codes and try this code

ActiveSupport.on_load(:action_controller) do
  include ActionController::ParamsWrapper
  wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM