Skip to content

Instantly share code, notes, and snippets.

@solomon081
Created June 14, 2012 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solomon081/2931239 to your computer and use it in GitHub Desktop.
Save solomon081/2931239 to your computer and use it in GitHub Desktop.
AGG SQL
class Song < ActiveRecord::Base
composed_of :songinfo, :class_name => "SongInfo", :mapping => [%w(title, title)]
end
require 'active_record'
ActiveRecord::Base.establish_connection(:database => "test.db", :adapter => "sqlite3")
CREATE TABLE songs(
id INTEGER PRIMARYKEY AUTOINCREMENTED,
title VARCHAR
);
song = Song.find(1)
song.title == "Red House"
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