Showing posts from May, 2012

Rails - to create a blog site Part 2

Creating a resource. The format used is as follow : $ rails generate scaffold <resource name> <list of fields> Example : $ rails generate scaffold test_j author:string title:string tag:string content:text create_datetime:timestamp Create associated table in the database. $ rake db:migrate Then you are done! This new resource can be accessed by<resource name>/ For the example that I used, it would be http:// Click on the New Test_j link will give you the form that we created with the one line command earlier. Note that, the date time is showing current GMT time. I haven't figured out why/how matters. :)

Rails - to create a blog site Part 1

Tutorial that I am following is from this site : I choose to sudo as root to avoid the permission issue. $ sudo su Install Ruby $ apt-get install rubygems Install Rails $ gem install rails Create a blog application $ rails new blog Note : You might encounter this error. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension To solve this, install sqlite before create the blog application. $ apt-get install libsqlite3-dev $ gem install sqlite3 -v '1.3.6' Create a database $ rake db:create You might encounter this error. rake aborted! Could not find a JavaScript runtime. See for a list of available runtimes. Go to the created blog directory. Edit this file : Gemfile. Uncomment this line : gem 'therubyracer', :platform => :ruby Run this (installing nodejs and also reinstall rails) : $ apt-get install nodejs $ bundle install To start t