I've followed this article to do this, but after I excuted rails server, he just gave me the output of rails -h, I have no idea about it, somebody help me out!!
Did you created any project yet? you have installed rails correctly. Now you have to create project. If you have created your project than do cd myapp and now run following command
rails s
It should work, I hope you already installed postgres as per tutorial, but if not no worry, following will still work using sqlite3
rails new newmyapp
It will show you screenflow activities. Now it finish just change directory to myapp using cd newmyapp and run following command
rails s
it will show your famous rails page.
Related
I am new to rails and am following the tutorial posted on the ROR website. Everything is working fine until I try and load up my rails application on the localhost. Every time enter $ rails server I get a long list of possible commands and functions. When I check my localhost:3000 and 127.0.0.1:3000, nothing seems to be connected.
Upon digging deeper, I have tried almost everything everyone else has tried. I am running the command in the same path as my new rails application. Furthermore, when I enter in nonsense after the $ rails command I get the same list of possible commands and functions. So I get the feeling that rails is not recognizing the server command.
Here are my versions:
Ruby 1.9.3 p374
Rails 3.2.11
Why isn't the server command recognized?
First of all you have to move to the project directory and install bundle with the following command:
bundle install
Then start the server:
rails server
I had the same problem. rails server or simply rails s only works when you are in the right directory.
Type pwd (present working directory) to see where you currently are.
Type cd and the rest of the direction to the correct directory.
(for example, "cd workspace/learn-rails")
Type rails server or rails s.
Check http://localhost:3000.
Please exit from terminal and then restart the terminal.
Then check the directory path i.e just type pwd it will show the current directory path.
And if directory is correct on try again running command like bundle install & rails server
I think this should be work.
im really new to ruby and ROR and im having real trouble trying to get my directory that i created earlier to open in terminal (on a mac) and then start the rails server so i can preview it in the browser.
ive been trying :
cd /Users/sam/Documents/Pudle/Projects/treeb
and
ruby /Users/sam/Documents/Pudle/Projects/treeb
then running rails s
i think the problem im having is that im not loading in the directory correctly, appologies for it being such a simple question but ive been going round in circles with this for hours !
any helps much appreciated
Assuming you've created your new Rails application using rails new app_name, you can simply start the server by running cd /Users/sam/Documents/Pudle/Projects/treeb and rails s
Ref how to create a rails application
suppose your application path is cd /Users/sam/Documents/Pudle/Projects/treeb
then do following to start the server
cd /Users/sam/Documents/Pudle/Projects/treeb
rails server #or just rails s
NOTE:- Above will work only if you are using Rails 3
For Rails 2
ruby script/server
I have just started to learn Ruby on Rails and in going through a tutorial I am not able to launch the rails project because of the following error.
-e:4:in `load': no such file to load -- script/server (LoadError)
from -e:4:in `<main>'
I have installed Ruby 1.9.2 and using RadRails as the IDE for creating and executing the Rails project. Any suggestions?
Most likely your tutorial refers to Rails 2 (for which given command works), while you're using Rails 3.
I'm not sure how exactly you start server in Rails 3 (edit see answer by jdl), but take my adice: find another tutorial. Otherwise, you'll have to create such questions here several times a day :)
If you just installed the latest Rails the the command has changed (as of Rails 3) to:
$ ./script/rails server
I think the best way to start a server in Rails 3 is to run this command from the root of the project:
rails server
You should have the rails executable in your path if you've installed the Rails 3 gem.
I tried the rails site_name command to create a rails application. The command says that the usage is rails new APP_PATH[options]
I tried the rails new site_name command.
I dont get any server file inside my site_name/script folder to run the application.
why is this happening?
Use
$ rails server
to start the server. In general with Rails 3, any command you would have previously run with ./script/... you now run with rails ...
I installed rails 3 beta in my OSX Leopard. After that, I've created a rails project to test it. From inside its folder, I just can't do script/generate, or even script/server.
It returns '-bash: script/server: No such file or directory'. How could I resolve this issue?
Rails 3 has done away with script/*. Use rails server, rails generate, etc. while in your app's directory.
Run rails --help to get the full list.
In Rails 3, instead of using script/*, use rails. So instead of writing script/generate use rails g (alias of generate) and instead of script/server use rails s (alias of server).
The additional usage of port/environment is the same as in Rails 2. So you can add the port 3005 (default is 3000) with production environment as rails s -p 3005 -e production. Hope that will solve your problem.