Created
May 7, 2010 16:33
-
-
Save joonyou/393680 to your computer and use it in GitHub Desktop.
active record test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w(rubygems active_record sqlite3).each {|lib| require lib} | |
ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', | |
:database => 'rtest.sqlite3' | |
}) | |
class TestMigration < ActiveRecord::Migration | |
def self.up | |
create_table :joons do |t| | |
t.string :name | |
t.string :status | |
end | |
end | |
end | |
TestMigration.migrate(:up) | |
class Joon < ActiveRecord::Base | |
end | |
Joon.new({:name => 'Ellen', :status => 'daughter'}).save | |
Joon.new({:name => 'Joon', :status => 'rubyhead'}).save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment