Starting a rails server in Rails 3
Asked Answered
A

3

7

I have created a new rails project with the command:

rails project_name

but now in that project if I run:

rails server

I just creates a new project call server, it doesn't start webrick.

How do I start the server and get rails running?

Alcock answered 15/12, 2010 at 21:56 Comment(1)
Actually guys, if I do a -v to see which version of rails I have it says 3.0.3. But if I run script/server it's works and says it's version 2. What the hell's going on.Alcock
A
3

You're mixing Rails 2 and Rails 3 commands. By the looks of it, you're using Rails 2, which means starting the server would be script/server, not rails server

Anorexia answered 15/12, 2010 at 22:0 Comment(7)
If that's the case then you would've needed to use rails new new_project to create the project. The rails new_project syntax has been removed since all the old script/* commands have been moved into the rails command. Double-check with rails -vAnorexia
@Smickie I wouldn't be so sure, type rails -v to find out.Keil
Actually guys, if I do a -v to see which version of rails I have it says 3.0.3. But if I run script/server it's works and says it's version 2. What the hell's going on.Alcock
If script/server even exists, it means it's a Rails 2 app. It means you've got rails 3 installed but the app needs upgrading.Anorexia
For me, neither rails server nor rails script/server start webrick. rails -v outputs Rails 2.3.14, how can I start webrick?Platino
In Rails 2 and below, it's just script/server, not rails script/serverAnorexia
script/server outputs -bash: script/server: No such file or directoryPlatino
E
6

Old versions or rails are bugging you. Deinstall them using gem uninstall rails. I recommend using RVM with gemsets to create separate environments for each project.

Efface answered 15/12, 2010 at 22:4 Comment(0)
A
3

You're mixing Rails 2 and Rails 3 commands. By the looks of it, you're using Rails 2, which means starting the server would be script/server, not rails server

Anorexia answered 15/12, 2010 at 22:0 Comment(7)
If that's the case then you would've needed to use rails new new_project to create the project. The rails new_project syntax has been removed since all the old script/* commands have been moved into the rails command. Double-check with rails -vAnorexia
@Smickie I wouldn't be so sure, type rails -v to find out.Keil
Actually guys, if I do a -v to see which version of rails I have it says 3.0.3. But if I run script/server it's works and says it's version 2. What the hell's going on.Alcock
If script/server even exists, it means it's a Rails 2 app. It means you've got rails 3 installed but the app needs upgrading.Anorexia
For me, neither rails server nor rails script/server start webrick. rails -v outputs Rails 2.3.14, how can I start webrick?Platino
In Rails 2 and below, it's just script/server, not rails script/serverAnorexia
script/server outputs -bash: script/server: No such file or directoryPlatino
A
1

Step by Step rails server Installation :

  1. Create Gemset using " rvm create gemset "
  2. rails new
  3. goto rails app directory "cd/"
  4. gem install rails
  5. echo "rvm use " > .rvmrc for example : echo "rvm use 1.9.3-p385@mygemset" > .rvmrc
  6. run - "bundle install"
  7. rails s

yeah, nothing to do more... :)

Army answered 21/6, 2013 at 6:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.