Для новичка достаточно начинать освоение Rails без помощи людей и IRC канала. Если у Вас возникнут проблемы, пишите туда, ибо автор пребывает там довольно регулярно.
That said, some sample code is worth its weight in gold, so here’s how I got a basic Rails application running.
Для начала поямотрите GettingStartedWithRails (где опи�?аны о�?новные моменты), потом — http://api.rubyonrails.org/, где можно найти некоторые �?оветы по у�?тановке.
I will repeat some of it here, but that is where I started.
1a. �?а�?тройте Apache дл�? работы �? Rails (�?м. «Пример на�?троки Apache»[1]).
ИЛИ
1b. Запу�?тите WEBrick �?ервлет: ruby script/server -- help (�?м. «WEBrick configuration example» below2.)(Run this from the Rails application directory)
2. Go to http://rails/ (or whatever your ServerName is) and check that you get the “Congratulations, you’re on Rails!” screen
2b. In case of WEBrick, go to http://localhost:3000. Apache2 note: The httpd.conf contains an entry which determines the port to be used. For example, ServerName AServerNameHere:80, port 80 was selected. Try the following url http://localhost:80/.
3. Follow the guidelines on the “Congratulations, you’ve put Ruby on Rails!” screen
1 In the Apache configuration below, replace ”/path/application” in each case with the full path to the rails directory unpacked with the tar.gz, and be sure to append the “public” or “log” directory where noted below. I also had to turn on CGI and set some access requirements – also shown below (Suse 9.1’s Apache is locked down fairly tight)
<VirtualHost *:80>
ServerName rails
DocumentRoot /path/application/public/
ErrorLog /path/application/log/apache.log
<Directory /path/application/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
An alternative Apache 2 configuration example, that modifies your existing Apache to have a rails enabled directory (rather than a dedicated virtual host) might be
Alias /rails/ /var/www/rails/ <Directory /var/www/rails/> Options ExecCGI AddHandler cgi-script .cgi Order allow,deny Allow from all </Directory>Which should now be accessible from:
2 WEBrick servlet help output
$ ruby script/server --help
Usage: ruby server [options]
-p, --port=port Runs Rails on the specified port.
Default: 3000
-b, --binding=ip Binds Rails to the specified ip.
Default: 127.0.0.1
-i, --index=controller Specifies an index controller
that requests for root will go to
(instead of congratulations screen).
-d, --daemon Make Rails run as a Daemon (only works if
fork is available -- meaning on *nix).
-c, --cache-classes Caches class compilation which will speed up
the serving of requests, but require a
server restart on source changes.
-h, --help Show this help message.
You’ve successfully configured your web-server to point at this Rails application.
Once you have seen this in your web browser, your rails application is ready to begin programming. Follow these steps:
1. TutorialStepOne – Create empty production and test databases for your application.
2. TutorialStepTwo – Edit config/database.yml with your database settings.
3. TutorialStepThree – Create a new controller using the script/generate controller generator
(run with no arguments for documentation).
4. TutorialStepFour – Create a new model using the script/generate model generator
(run with no arguments for documentation).
5. TutorialStepFive – See all the tests run and the app documentation be created by running rake.
6. TutorialStepSix – Develop your Rails application!
7. Setup FastCGI? or mod_ruby to get production-level performance
category:Tutorial