today
thiyagu
sir told the difference between ruby using ordinary mysql
and Ruby using ORM(object Relational Mapping)
create a database called student
Ruby code to access the table rubyists (ORM using Ruby)
i wondered here sql function not using anywhere in this programme
Let's write a Ruby program and name it as db_connect.rb
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:database => "students"
class Rubyist < ActiveRecord::Base
end
Rubyist.create(:name => 'Luc Juggery', :city => "Nashville, Tenessee")
Rubyist.create(:name => 'Sunil Kelkar', :city => "Pune, India")
Rubyist.create(:name => 'Adam Smith', :city => "San Fransisco, USA")
Then sir also told the ordinary way of connecting this programme through mysql
No comments:
Post a Comment