Ruby on Rails

From Bashlinux
Revision as of 00:30, 7 June 2015 by Manpaz (talk | contribs) (Created page with "__NOTOC__ == Installation == '''Debian'''<br> As root issue the following command: gem install rails {{Infobox | Binary gems directory is not added automatically on <tt>$PAT...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installation

Debian
As root issue the following command:

gem install rails
Warning Binary gems directory is not added automatically on $PATH
In order to run gem binaries available at bin directory, the location /var/lib/gems/1.8/bin must be added as described in /usr/share/docs/rubygems1.8/README.Debian.

Fedora
Its very easy, rubygem-rails must provide all the needed packages and dependencies

yum install rubygem-rails

How to create a Rails application

  1. Set a location to deploy rails applications (eg. /var/rails)
  2. Create Rails application
mkdir -p /var/rails
cd /var/rails
rails newrail

Development

How to publish a Rails application

Assuming the name of the Rail Application is newrail and the location for all new Rail Applications is /var/rails, thus a Rail Application can be published in 2 ways:

  1. Via Builtin Webserver, called WEBrick by running /script/server located in the folder where it was created.
cd /var/rails/newrail/script
./server &
  1. Via Apache Web Server by setting the proper DocumentRoot varible with the location of the public folder in the Rail Application
DocumentRoot /var/rails/newrails/public

<Directory /var/rails/newrails/public>
    Options ExecCGI FollowSymLinks
    AddHandler cgi-script .cgi
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>
 ...