Created
June 11, 2010 17:26
-
-
Save anonymous/434783 to your computer and use it in GitHub Desktop.
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
require 'active_record' | |
puts 'password please' | |
pass=gets.chomp | |
ActiveRecord::Base.establish_connection(:adapter => 'postgresql', | |
:host => 'foo', | |
:username => 'foo', | |
:password => pass, | |
:database => 'foo') | |
#Created with: | |
#CREATE TABLE demos | |
#( | |
# id uuid NOT NULL, | |
# data text, | |
# CONSTRAINT demos_pkey PRIMARY KEY (id) | |
#) | |
class Demo < ActiveRecord::Base | |
end | |
#so we don't error out if the script is run multiple times | |
Demo.delete_all | |
demo1=Demo.new(:data=>'foo') | |
demo2=Demo.new(:data=>'bar') | |
demo1.id='36d171f1-cd53-440e-bca7-1281753a5545' | |
demo2.id='bd816883-c774-4497-9cfe-1105208a58d4' | |
demo1.save | |
demo2.save | |
puts Demo.find('bd816883-c774-4497-9cfe-1105208a58d4').data | |
puts Demo.find('36d171f1-cd53-440e-bca7-1281753a5545').data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment