My First Rails 3 Web App
I'm so excited to learn this new thing (for me it is a new thing). I have been working on other things like developing native apps, mostly in C/C++. My web app experience was limited to ASP .NET only.
What I wanna build is an application that could receive data from user (user could upload data), then identify the data and parse (extract) it. The extracted information then served in RESTful manner.
1. Generate a new Rails app.
$ rails new dipa --skip-active-record
The --skip-active-record means, I don't want to use the Rails' ActiveRecord, since I would like to get advantage in using MongoDB instead.
2. Edit the Gemfile
$ vim Gemfile
require 'rubygems'
require 'mongo'
source 'http://rubygems.org
# gem list
gem 'rails', '3.0.3'
gem 'mongo_mapper'
gem 'rails3-generators'
$ bundle install
vim config/initializers/mongo.rb
MongoMapper.connection = MongoMapper::Connection.new('localhost',27017);
MongoMapper.database = "dipa-#{Rails.env}"
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.connection.connection_to_master if forked
end
end

