Quick step to Ruby on Rails on Fedora Linux Platform

This is a simple not how to install Ruby on Rails on Fedora platform and run your first database application.
1. Install Ruby on Rails is simple in Fedora platform. You can find the version of your Fedora 'uname -a'. Execute the following command to install
Logging as root before install
    <...>su -   
    <...>sudo yum install rubygem-rails rubygem-sqlite3-ruby



2. Setup the workspace. I have my all ruby applications under the one folder. This best practice I learnt from the Eclipse.
    home>mkdir rubyws
    home>cd rubyws

3. Next create your first ruby application, for example myapp (from the http://wiki.rubyonrails.org/getting-started/first-rails-app-walkthrough which was not worked form me -:  that is why I wrote this blog)
    home>rails myapp
    home>cd myapp
    myapp>

This will create myapp directory under the workspace.

4. Start the server in the different console
    myapp>script/server

5. create the database
    myapp>rake db:create
This will create the default development database. In the case of the Sqllite3 not successfully installed try sudo yum install ruby-sqlite3 (as I did)

6. Generate scaffold
    myapp>script/generate scaffold
Now, take a look at output generated.

7. Start generating web application. First create user table
    myapp>script/generate scaffold user first_name:string last_name:string active:boolea

8. The last step is migration, execute the following command
    myapp>rake db:migrate

Now you are ready to run your application. In the browser, go to the url http://localhost:3000/users (think about last 's', it is necessary).

Reference (but this doesn't worked in my machine)
http://wiki.rubyonrails.org/getting-started/first-rails-app-walkthrough




Comments

Popular posts from this blog

How To: GitHub projects in Spring Tool Suite

Spring 3 Part 7: Spring with Databases

Parse the namespace based XML using Python