Rails Server Command
I am new to Ruby on Rails and am following a tutorial to create a class project.
I can generate a new rails project with
$ rails project
The problem Im having is when I try to start my server, It will generate a project ca开发者_JAVA百科lled server:
$ rails server
or
$ rails s
I figured out that I need to install/update rails to 3.0.3 to use this command every time I open terminal. I find myself having to install gems(bundle, etc) every time I need to work on my project.
Is there anyway to save this terminal session or profile for later use?
Is it user error?
Im new to Rails and about the same with terminal.
Any help would be greatly appreciated. I have resorted to leaving my computer and terminal open for about a week...
Welcome on board! - You'll have fun, I found setting up the environment the most difficult thing.
in rails 2 you start the server with ruby script/server
.
to upgrade to rails 3 try gem install rails -v=3.0.4
I put the version but it's not a mandatory option.
To uninstall a gem (as rails is) is gem uninstall gemname -v=x.x.x
. -
gem list
will tell you the version of each gem.
I hope you've got rvm, if not I strongly sugget you to install it, this will allow you not only to use different versions of ruby but also to set different gemsets, therefor one each project, you'll find it useful.
Once in rails 3 you can use bundler, have a look at this episode of railscasts, by the way this is a very good site, but you may know it already.
another edit...
I don't know the behavior you're describing, looks like something is wrong with your environment, but I need to know if you have rvm to solve this, if so try rvm list
and rvm gemset
, With the first you get the list of installed ruby, you can switch between them with rvm 1.9.2
i.e. and rvm 1.9.2@gemdirname
with the gemdir coming from the second list. You should find your configuration in one of those list.
Hi if you are using rails 2.8 or lesser use this to start the server
ruby script/server
rails new project
is for new rails project n rails s
is for starting server
精彩评论