This file contains hidden or 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
| caelesta:dm knowtheory$ ruby trans_test2.rb | |
| [2148303280] DO open_connection = 2157337300 | |
| [2148303280] TXN open_connection = 2157337300 (current = 4) | |
| [2148303280] TXN close_connection(2157337300) (current = 4) | |
| [2148303280] DO close_connection(2157337300) (current = 2157337300) | |
| [2148303280] DO open_connection = 2157337300 | |
| [2148303280] TXN open_connection = 2157337300 (current = 4) | |
| [2148303280] TXN close_connection(2157337300) (current = 4) | |
| [2148303280] DO close_connection(2157337300) (current = 2157337300) |
This file contains hidden or 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
| { | |
| :tracks => { | |
| :uuid1 => {:track_name => "The Sign", :album_name => "The Sign", :artist_id => 1}, | |
| :uuid2 => {:track_name => "Walking On Broken Glass", :album_name => "Diva", :artist_id => 2}, | |
| :uuid3 => {:track_name => "Autumn Leaves", :album_name => "Philosophy", :artist_id => 3} | |
| } | |
| } |
This file contains hidden or 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
| >> @chrome_history = "sqlite3:///Users/knowtheory/data/chrome_history" | |
| => "sqlite3:///Users/knowtheory/data/chrome_history" | |
| >> require 'dm-chrome-history' | |
| => true | |
| >> url = Url.first; url.valid?; url.errors | |
| => #<DataMapper::Validations::ValidationErrors:0x101619890 @errors=#<OrderedHash {:url=>["Url has an invalid format"], :last_visit_time=>["Last visit time must be an integer"]}, resource#<Url @id=1 @url=#<Addressable::URI:0x80b0d044 URI:http://mail.knowtheory.net/ @title="Knowtheory Mail" @visit_count=108 @typed_count=72 @last_visit_time=Wed Aug 25 09:32:57 -0400 2010 @hidden=0 @favicon_id=2> | |
| >> class Url; property :url, String, :format => :url; property :last_visit_time, Integer, :required => true; end | |
| => #<DataMapper::Property::Integer @model=Url @name=:last_visit_time> | |
| >> url = Url.first; url.valid?; url.errors | |
| => #<DataMapper::Validations::ValidationErrors:0x101596ff8 @errors=#<OrderedHash {}>, resource#<Url @id=1 @url="http://mail.knowtheory.net/" @title="Knowtheory Mail" @visit_count=108 @typed_count= |
This file contains hidden or 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 'dm-core' | |
| require 'dm-migrations' | |
| require 'dm-timestamps' | |
| require 'dm-sweatshop' | |
| DataMapper.setup(:default, "[insert_path_here]") | |
| class Widget | |
| include DataMapper::Resource | |
This file contains hidden or 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
| module Food | |
| def self.included(model) | |
| model.property :id, Serial | |
| model.property :price, Integer, :min => 0 # builtin validation works just fine | |
| model.property :calories, Integer, :min => 0 | |
| model.before(:valid?, :custom_validation) | |
| end | |
| def custom_validation |
This file contains hidden or 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
| =begin | |
| CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR); | |
| CREATE TABLE presentation(url_id INTEGER PRIMARY KEY,pres_index INTEGER NOT NULL); | |
| CREATE TABLE segment_usage (id INTEGER PRIMARY KEY,segment_id INTEGER NOT NULL,time_slot INTEGER NOT NULL,visit_count INTEGER DEFAULT 0 NOT NULL); | |
| =end | |
| require 'dm-core' | |
| require 'dm-validations' | |
| require 'dm-aggregates' |
This file contains hidden or 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
| module DataMapper | |
| class Query | |
| OPTIONS << :join | |
| def assert_valid_options(options) | |
| assert_kind_of 'options', options, Hash | |
| options.each do |attribute, value| | |
| case attribute | |
| when :fields then assert_valid_fields(value, options[:unique]) |
This file contains hidden or 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
| module RequireTree | |
| @@require_tree = {:system => $".dup} | |
| def require(string) | |
| @current = $".dup | |
| result = super(string) | |
| @@require_tree[string] = $" - @current | |
| result | |
| end | |
This file contains hidden or 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 'dm-core' | |
| require 'dm-migrations' | |
| DataMapper.setup(:default, "sqlite::in_memory:") | |
| class User | |
| def password=(value) | |
| raise NotImplementedError.new("I pity da f00!") | |
| end | |
| end |
This file contains hidden or 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
| Thank you for installing merb-core 1.1.1 | |
| The planned route for upgrading from merb 1.1.x to 1.2 will involve | |
| changes which may break existing merb apps. Fear not, fixes for | |
| apps broken by 1.2 should be trivial. Please be sure to read | |
| http://wiki.github.com/merb/merb/release-120 for the details | |
| regarding usage of the upcoming 1.2 release. |