Skip to content

Ruby class:Day 6- Rails – Active record


This day i know about Active record.

Rails uses ORM ( Object Relational Mapping)

usually we connect the database using the queries with in the quote through the languages.

queries are slightly different to various databases like Oracle, MySql, etc., in this case doesn’t change database one to another

if wants means change all queries as per the databases.

but Rails provide active_record concept . It is an Domain Specific language

we connect the database via rails not use the DB queries. so we can easily change various databases.

Mr. Thayagarajan explained the comparisons of usual way and active_record(rails)

active_record example:

require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(:adapter => "mysql",:host => "localhost",:username => "root",:password => "password",:database => "rubyclass")
class Student < ActiveRecord::Base
belongs_to :standard
class Standard <  ActiveRecord::Base
has_many :students
all_students = Student.find(:all)
all_students.each do |child|
puts +

Rails installation in tamil here.


From → Ruby

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: