Created
June 14, 2012 16:13
-
-
Save solomon081/2931239 to your computer and use it in GitHub Desktop.
AGG SQL
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
class Song < ActiveRecord::Base | |
composed_of :songinfo, :class_name => "SongInfo", :mapping => [%w(title, title)] | |
end |
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' | |
ActiveRecord::Base.establish_connection(:database => "test.db", :adapter => "sqlite3") |
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
CREATE TABLE songs( | |
id INTEGER PRIMARYKEY AUTOINCREMENTED, | |
title VARCHAR | |
); |
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
song = Song.find(1) | |
song.title == "Red House" |
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
song = Song.new | |
song.songinfo = SongInfo.new("Red House") | |
song.save | |
song.title == "Red House" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment