From Gentoo Wiki
Jump to:navigation Jump to:search

Rails or Ruby on Rails is an MVC web application framework written in Ruby.


USE flags

USE flags for dev-ruby/rails ruby on rails is a web-application and persistence framework

doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)


Install dev-ruby/rails:

root #emerge --ask dev-ruby/rails


root /var/www #rails new ror
root /var/www #cd ror
root /var/www/ror #rails server

Point a web browser to are now riding rails via WEBrick. This is only for testing, not production. WEBrick could probably be used for production if it were behind nginx or an accelerator proxy such as varnish.


Rails is not eselect aware, this might come in handy to resolving some issues, but be aware that bundle install will blast things away.

root #eselect rails list
root #eselect rails set 1

Passenger via apache

Emerge passenger:

root #emerge --ask www-apache/passenger

Add -D PASSENGER to the APACHE2_OPTS variable in Apache's config:

FILE /etc/conf.d/apache2add -D PASSENGER to apache's config

Passenger needs Apache to relax the rules a little bit. Edit the /etc/apache2/modules.d/30_mod_passenger.conf file and insert relaxed settings before the closing </IfDefine> tag:

FILE /etc/apache2/modules.d/30_mod_passenger.confapache 2.2
<Directory />
	Options FollowSymLinks
	AllowOverride all
	Order allow,deny
	Allow from all
FILE /etc/apache2/modules.d/30_mod_passenger.confapache 2.4
<Directory />
	Options FollowSymLinks
	AllowOverride all
	Require all granted

Backup the original Apache vhost:

root #mv /etc/apache2/vhosts.d/00_default_vhost.conf /etc/apache2/vhosts.d/00_default_vhost.conf.backup

Drop in the passenger vhost file for Apache:

FILE /etc/apache2/vhosts.d/00_default_vhost.conf
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
      DocumentRoot /var/www/ror/public    
#  RailsBaseURI /
  RailsEnv development
      <Directory /var/www/ror/public>
Options -MultiViews
root #/etc/init.d/apache2 restart

Point a web browser to or or http://localhost and your riding rails via passenger now.

See also

  • Ruby - The programming language used to build Rails.

External resources