Skip to content

Instantly share code, notes, and snippets.

@knowtheory
knowtheory / gist:45654
Created January 11, 2009 06:00
My stab at fixing the Merb wiki
====== Welcome to the Merb Wiki! =======
===== Homepage and Information Routing =====
Welcome to the Merb Wiki! This wiki is set up in order to help users of all skill levels. Herein you should be able to find information about specific subjects, [[merb|learn more about Merb]] and [[development|how to use it]], and find [[further resources]].
* **__Looking for specific content__**? Or those who like to jump right in, feel free to use the table of contents to the right or [[http://wiki.Merbivore.com/?do=index|the full document index]].
* **__New user__**? We have [[articles]] about [[what Merb is]], and what it's [[history]], [[philosophy]] are, and what [[it's future]] will be (and [[the merge with Rails]]). If you are [[new to Ruby]] as well, we've got [[links for that]] too!
* **__Rails users__** may be interested in the [[differences between Merb and Rails]], and [[tutorials]] on how to get up and running with Merb.
* **__Already a Merbist__**? Looking for more info? You may be in
github.com/lritter/dm-solr-adapter
github.com/hassox/dm-polymorphic
github.com/godfat/dm-mapping
github.com/sunfmin/dm-gitdb
github.com/pius/dm-semantic
github.com/atmos/dm-references
github.com/shanna/dm-sphinx-adapter
github.com/aq1018/dm-is-taggable
github.com/dbussink/dm-constraints
github.com/krobertson/dm-paperclip
412038: A. Lawrence Foster,A. Foster
401531: Aaron Bliss
401856: Aaron Brown
402077: Aaron Burr
402697: Aaron Cochrane
402968: Aaron Cragin
404210: Aaron Ford
404891: Aaron Hackley
405068: Aaron Harding
405086: Aaron Harlan
@knowtheory
knowtheory / Explanation
Created January 28, 2009 00:52
Modification to /lib/dm-core/adapters/data_objects_adapter.rb
The two stack traces you see below indicate DataMapper's failure to respect multiple joins.
The DB schema we created is as follows:
Bill:
has n, RollCall
has n, Bill::Title
As it became apparent, DM wasn't properly identifying the table to join to the query.
>> Member.new(Member.first(:id => "400001").attributes).valid?
~ (0.001096) SELECT "id", "name", "birthday", "gender", "osid", "bioguide", "metavidid", "state", "district" FROM "members" WHERE ("id" = '400001') ORDER BY "id" LIMIT 1
=> true
>> Member.new(Member.first(:id => "400001").attributes).save
~ (0.000888) SELECT "id", "name", "birthday", "gender", "osid", "bioguide", "metavidid", "state", "district" FROM "members" WHERE ("id" = '400001') ORDER BY "id" LIMIT 1
~ (0.000379) INSERT INTO "members" ("bioguide", "birthday", "state", "gender", "district", "name", "osid", "id") VALUES ('A000014', '1938-06-26', 'HI', 'M', 1, 'Rep. Neil Abercrombie [D, HI-1]', 'N00007665', '400001')
~ (sql_state=23505) ERROR: duplicate key value violates unique constraint "members_pkey"
Query: INSERT INTO "members" ("bioguide", "birthday", "state", "gender", "district", "name", "osid", "id") VALUES ('A000014', '1938-06-26', 'HI', 'M', 1, 'Rep. Neil Abercrombie [D, HI-1]', 'N00007665', '400001')
PostgresError: (sql_
require 'merb'
require 'config/dependencies'
app_models = Pathname.new("app/models")
Dir.open(app_models).each do |model|
path = app_models / model
# puts "Requring " + path if path.to_s =~ /\.rb$/
require path if path.to_s =~ /\.rb$/
end
require "lib/access_congress/dm_types"
umbra:rolls ted$ ack "year=\"1969\""
s2000-301.xml
1:<roll where="senate" session="91" year="1969" roll="301" when="" aye="0" nay="0" nv="0" present="0">
s2000-302.xml
1:<roll where="senate" session="91" year="1969" roll="302" when="" aye="0" nay="0" nv="0" present="0">
s2000-303.xml
1:<roll where="senate" session="91" year="1969" roll="303" when="" aye="0" nay="0" nv="0" present="0">
s2000-304.xml
1:<roll where="senate" session="91" year="1969" roll="304" when="" aye="0" nay="0" nv="0" present="0">
s2000-305.xml
# -*- coding: utf-8 -*-
require 'treetop'
#require 'lib/measures'; require 'metric/metric'
module TreetopExt
def tokens(options={})
if nonterminal?
return elements.map{ |e| e.tokens(options) }.flatten.compact
elsif input[interval].empty? or input[interval] =~ /\s+/
return nil
else
#!/usr/bin/ruby
#creating a new class:
class Anime
def initialize(title, year, genre)
@title=title
@year=year
@genre=genre
end
def to_s
umbra:knowtheory ted$ ../appengine-java-sdk/bin/dev_appserver.sh tmp/war/
2009-04-08 16:32:42.217 java[17501:80f] [Java CocoaComponent compatibility mode]: Enabled
2009-04-08 16:32:42.218 java[17501:80f] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Loading init file from /Users/ted/Code/gae/knowtheory/tmp/war/WEB-INF/config/init.rb
Loading /Users/ted/Code/gae/knowtheory/tmp/war/WEB-INF/config/environments/production.rb
Logging to file at /Users/ted/Code/gae/knowtheory/tmp/war/WEB-INF/log/production.log
Apr 8, 2009 4:32:57 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: [1239222777443000] javax.servlet.ServletContext log: unable to create shared application instance
org.jruby.rack.RackInitializationException: No such file or directory
from /Users/ted/Code/gae/knowtheory/tmp/war/WEB-INF/gems/gems/merb-core-1.0.11/lib/merb-core/bootloader.rb:437:in `update_logger'