anggo active record neng jobone rails

1. gem install activerecord
2. setting.rb
require ‘rubygems’
require ‘active_record’

ActiveRecord::Base.establish_connection(
:adapter => “mysql”,
:host => “localhost.com”,
:database => “arane_db”,
:username => “jowo”,
:password => “ninja.rb”
)

3. schema.rb
require ‘setting’
class SangatBerkelasDanNarsis < ActiveRecord::Base
end

4. scriptku.rb
require ‘schema’
x = SangatBerkelasDanNarsis.find_by_blog_prefix(“arisanshi”)

5. puts x.to_yaml
6. ngantuk, arep turu.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: