<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>sick.snusnu.info</title>
	<link>http://sick.snusnu.info</link>
	<description></description>
	<pubDate>Wed, 04 Nov 2009 18:27:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>Installing nokogiri with rvm on Snow Leopard</title>
		<link>http://sick.snusnu.info/2009/11/04/installing-nokogiri-with-rvm-on-snow-leopard/</link>
		<comments>http://sick.snusnu.info/2009/11/04/installing-nokogiri-with-rvm-on-snow-leopard/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 18:26:54 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby rvm]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/11/04/installing-nokogiri-with-rvm-on-snow-leopard/</guid>
		<description><![CDATA[In case you&#8217;re on Snow Leopard and experiencing weird errors when trying to install nokogiri into rvm have a look at the following. The problem is architecture related and the solution is described at the rvm FAQ. Basically, the following needs to be done:

rvm remove ree
rvm --force gems delete your_gemset_name
echo rvm_archflags=\"-arch x86_64\" > ~/.rvmrc
rvm install ree

]]></description>
			<content:encoded><![CDATA[<p>In case you&#8217;re on Snow Leopard and experiencing weird errors when trying to install nokogiri into <a href="http://rvm.beginrescueend.com">rvm</a> have a look at the following. The problem is architecture related and the solution is described at the <a href="http://rvm.beginrescueend.com/faq">rvm FAQ</a>. Basically, the following needs to be done:</p>
<pre>
rvm remove ree
rvm --force gems delete your_gemset_name
echo rvm_archflags=\"-arch x86_64\" > ~/.rvmrc
rvm install ree
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/11/04/installing-nokogiri-with-rvm-on-snow-leopard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>inspecting a many_to_many datamapper relationship object</title>
		<link>http://sick.snusnu.info/2009/06/25/inspecting-a-many_to_many-datamapper-relationship-object/</link>
		<comments>http://sick.snusnu.info/2009/06/25/inspecting-a-many_to_many-datamapper-relationship-object/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 22:08:47 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/06/25/inspecting-a-many_to_many-datamapper-relationship-object/</guid>
		<description><![CDATA[The output of calling inspect on a datamapper many_to_many relationship object is very informative
]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://pastie.org/523545">output</a> of calling inspect on a datamapper many_to_many relationship object is very informative</p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/06/25/inspecting-a-many_to_many-datamapper-relationship-object/feed/</wfw:commentRss>
		</item>
		<item>
		<title>migrating to datamapper 0.10.0</title>
		<link>http://sick.snusnu.info/2009/06/03/migrating-to-datamapper-0100/</link>
		<comments>http://sick.snusnu.info/2009/06/03/migrating-to-datamapper-0100/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 12:55:07 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/06/03/migrating-to-datamapper-0100/</guid>
		<description><![CDATA[Some prerequisites to get ready for datamapper 0.10.0
You need to have at least rubygems 1.3.5
You need to have a reasonably fresh rspec
The following git instructions only apply if you want to keep track of the ongoing datamapper development.
You can safely omit them if you followed the instructions in the original post to the google group.

sudo [...]]]></description>
			<content:encoded><![CDATA[<p>Some prerequisites to get ready for <a href="http://groups.google.com/group/datamapper/browse_thread/thread/a8311a198d00e96b">datamapper 0.10.0</a></p>
<p>You need to have at least rubygems 1.3.5<br />
You need to have a reasonably fresh rspec</p>
<p>The following git instructions only apply if you want to keep track of the ongoing datamapper development.<br />
You can safely omit them if you followed the instructions in the original post to the google group.</p>
<pre name="code" class="ruby">
sudo gem install addressable
mkdir git-sources
cd git-sources/
git clone git://github.com/datamapper/extlib.git
git clone git://github.com/datamapper/do.git
git clone git://github.com/datamapper/dm-core.git
git clone git://github.com/datamapper/dm-more.git
git clone git://github.com/snusnu/merb.git
cd extlib/
rake install
cd ..
cd do/data_objects/
rake install
cd ../do_sqlite3/
rake install
cd ../do_xxx/
rake install
cd ../..
cd dm-core/
rake install
cd ..
cd dm-more/
rake install
cd ..
</pre>
<p>Migrating your app to <a href="http://groups.google.com/group/datamapper/browse_thread/thread/a8311a198d00e96b">datamapper 0.10.0</a> is pretty painless,<br />
you mainly need to deal with deprecation notices:</p>
<p><code>options[:class_name]</code> is now <code>options[:model]</code><br />
<code>PropertySet#has_property?</code> is now <code>PropertySet#named?</code><br />
<code>update_attributes</code> is now <code>update</code> and doesn&#8217;t support the <code>*allow_attributes</code> parameter anymore<br />
<code>new_record?</code> is now <code>new?</code><br />
<code>:mutable =&gt; true</code> on a <code>has(n, :things, :through => :others)</code> relationship is not supported/necessary anymore<br />
<code>:remote_name</code> option for <code>has(n, :things, :through => :others)</code> is now called <code>:via</code><br />
<code>:some_property.in =&gt; ['val1', 'val2']</code> is not supported anymore in queries, just use <code>:some_property =&gt; ['val1', 'val2']</code><br />
<code>belongs_to :parent</code> now defaults to <code>:nullable => false</code><br />
When adding to associations, <code>post.comments.build(...)</code> is now <code>post.comments.new(...)</code></p>
<p>If you&#8217;re using merb and you&#8217;re fine using the master branch (upcoming merb-1.1) and not the latest release, all you need to do is update your <a href="http://github.com/wycats/merb">wycats/merb</a> clone or run the following commands.</p>
<pre name="code" class="ruby">
cd git-sources/
git clone git://github.com/wycats/merb.git
cd merb
sudo rake install
</pre>
<p>If you however want to use datamapper 0.10.0 with latest merb release (1.0.12 at the time of writing) you will currently need to run these commands (Thx again teamon for taking the time to backport stuff!).<br />
merb-1.0.13 will be released soon and will be fully compatible with datamapper 0.10.0.</p>
<pre name="code" class="ruby">
cd git-sources/
git clone git://github.com/wycats/merb.git
cd merb
git checkout -b 1.0.x --track origin/1.0.x
sudo rake install
</pre>
<p>You will maybe get some warnings about <code>merb-more</code> but you can safely ignore them.</p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/06/03/migrating-to-datamapper-0100/feed/</wfw:commentRss>
		</item>
		<item>
		<title>rake task to generate CHANGELOG file (for git repositories)</title>
		<link>http://sick.snusnu.info/2009/05/11/rake-task-to-generate-changelog-file-for-git-repositories/</link>
		<comments>http://sick.snusnu.info/2009/05/11/rake-task-to-generate-changelog-file-for-git-repositories/#comments</comments>
		<pubDate>Mon, 11 May 2009 00:31:33 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rake]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/05/11/rake-task-to-generate-changelog-file-for-git-repositories/</guid>
		<description><![CDATA[generate (or update) a CHANGELOG file for git repositories (shamelessly copied from manveru/ramaze).

desc 'update changelog'
task :changelog do
  File.open('CHANGELOG', 'w+') do &#124;changelog&#124;
    `git log -z --abbrev-commit`.split("\0").each do &#124;commit&#124;
      next if commit =~ /^Merge: \d*/
      ref, author, time, _, title, _, message = [...]]]></description>
			<content:encoded><![CDATA[<p>generate (or update) a CHANGELOG file for git repositories (shamelessly copied from <a href="http://github.com/manveru/ramaze/blob/4efbb88993648b5acb5e46b9577b7207a221ea09/tasks/changelog.rake">manveru/ramaze).</a></p>
<pre name="code" class="ruby">
desc 'update changelog'
task :changelog do
  File.open('CHANGELOG', 'w+') do |changelog|
    `git log -z --abbrev-commit`.split("\0").each do |commit|
      next if commit =~ /^Merge: \d*/
      ref, author, time, _, title, _, message = commit.split("\n", 7)
      ref = ref[/commit ([0-9a-f]+)/, 1]
      author = author[/Author: (.*)/, 1].strip
      time = Time.parse(time[/Date: (.*)/, 1]).utc
      title.strip!

      changelog.puts "[#{ref} | #{time}] #{author}"
      changelog.puts '', " * #{title}"
      changelog.puts '', message.rstrip if message
      changelog.puts
    end
  end
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/05/11/rake-task-to-generate-changelog-file-for-git-repositories/feed/</wfw:commentRss>
		</item>
		<item>
		<title>strip whitespace using rake</title>
		<link>http://sick.snusnu.info/2009/05/09/strip-whitespace-using-rake/</link>
		<comments>http://sick.snusnu.info/2009/05/09/strip-whitespace-using-rake/#comments</comments>
		<pubDate>Sat, 09 May 2009 03:59:29 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rake]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/05/09/strip-whitespace-using-rake/</guid>
		<description><![CDATA[This snippet is taken from the wonderful webrat library

desc 'Removes trailing whitespace'
task :whitespace do
  sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
end
]]></description>
			<content:encoded><![CDATA[<p>This snippet is taken from the wonderful <a href="http://github.com/brynary/webrat/blob/481bfe03c0829a7d858443ceb6a51e1587a0d931/Rakefile#L153">webrat</a> library</p>
<pre name="code" class="ruby">
desc 'Removes trailing whitespace'
task :whitespace do
  sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/05/09/strip-whitespace-using-rake/feed/</wfw:commentRss>
		</item>
		<item>
		<title>authenticated flash upload using merb-auth and dm-paperclip</title>
		<link>http://sick.snusnu.info/2009/05/07/authenticated-flash-upload-using-merb-auth-and-dm-paperclip/</link>
		<comments>http://sick.snusnu.info/2009/05/07/authenticated-flash-upload-using-merb-auth-and-dm-paperclip/#comments</comments>
		<pubDate>Thu, 07 May 2009 21:44:01 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[merb]]></category>

		<category><![CDATA[rack]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/05/07/authenticated-flash-upload-using-merb-auth-and-dm-paperclip/</guid>
		<description><![CDATA[In order to get multiple file upload working, we decided to use flash. The problem with the flash upload library we used (uploadify &#8212; another alternative is swfupload), is that they both don&#8217;t send the session cookie to the server.
Since we have to authenticate our image uploads, we needed to get around this by following [...]]]></description>
			<content:encoded><![CDATA[<p>In order to get multiple file upload working, we decided to use flash. The problem with the flash upload library we used (<a href="http://www.uploadify.com/">uploadify</a> &#8212; another alternative is <a href="http://swfupload.org/">swfupload</a>), is that they both don&#8217;t send the session cookie to the server.</p>
<p>Since we have to authenticate our image uploads, we needed to get around this by following 2 steps:</p>
<ol>
<li>install the rack middleware from below (original code by <a href="http://delagoya.com/">Angel Pizarro</a>, found via <a href="http://thewebfellas.com/blog/2008/12/22/flash-uploaders-rails-cookie-based-sessions-and-csrf-rack-middleware-to-the-rescue">thewebfellas)</a></li>
<li>send the raw cookie data as query parameter keyed by your apps <em>session_id_key</em></li>
</ol>
<pre name="code" class="ruby">
# Merb.root/lib/rack/flash_upload.rb
module Merb
  module Rack
    class SetSessionCookieFromFlash &lt; Merb::Rack::Middleware
      # :api: private
      def initialize(app, session_key = '_session_id')
        super(app)
        @session_key = session_key
      end
      # :api: plugin
      def call(env)
        if env["HTTP_USER_AGENT"] =~ /^(Adobe|Shockwave) Flash/
          params = Merb::Parse.query(env['QUERY_STRING'])
          if params[@session_key]
            env['HTTP_COOKIE'] = [@session_key, params[@session_key]].join('=').freeze
          end
        end
        @app.call(env)
      end
    end
  end
end

# Merb.root/config/rack.rb
require 'rack/flash_upload'
use Merb::Rack::SetSessionCookieFromFlash, Merb::Config[:session_id_key]</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/05/07/authenticated-flash-upload-using-merb-auth-and-dm-paperclip/feed/</wfw:commentRss>
		</item>
		<item>
		<title>datamapper storage engine reflection</title>
		<link>http://sick.snusnu.info/2009/05/07/datamapper-storage-engine-reflection/</link>
		<comments>http://sick.snusnu.info/2009/05/07/datamapper-storage-engine-reflection/#comments</comments>
		<pubDate>Thu, 07 May 2009 12:42:59 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/05/07/datamapper-storage-engine-reflection/</guid>
		<description><![CDATA[
# Find out what storage engines are installed and are supported by datamapper
# This could be especially useful in testing scenarios, where one wants to run
# specs against all adapters that are available on the machine in use.

require "rubygems"
require "dm-core"
require "spec"

module DataMapper

  def self.available_storage_engines
    [ :sqlite3, :mysql, :postgres ].select do &#124;name&#124;
 [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# Find out what storage engines are installed and are supported by datamapper
# This could be especially useful in testing scenarios, where one wants to run
# specs against all adapters that are available on the machine in use.

require "rubygems"
require "dm-core"
require "spec"

module DataMapper

  def self.available_storage_engines
    [ :sqlite3, :mysql, :postgres ].select do |name|
      storage_engine_available?(name)
    end
  end

  def self.storage_engine_available?(name)
    ::DataObjects.const_defined?(Extlib::Inflection.classify(name.to_s))
  end

end

# spec helper
# set it so that it fits your actually installed do_xxx drivers
AVAILABLE_STORAGE_ENGINES = [
  :sqlite3,
  :mysql
  # :postgres
]

describe 'DataMapper storage engine reflection: ' do

  describe 'DataMapper.storage_engine_available?(name)' do
    it 'should return true for adapters known to be installed on this machine' do
      DataMapper.storage_engine_available?(:sqlite3).should  == AVAILABLE_STORAGE_ENGINES.include?(:sqlite3)
      DataMapper.storage_engine_available?(:mysql).should    == AVAILABLE_STORAGE_ENGINES.include?(:mysql)
      DataMapper.storage_engine_available?(:postgres).should == AVAILABLE_STORAGE_ENGINES.include?(:postgres)
    end
  end

  describe 'DataMapper.available_storage_engines' do
    it 'should try all adapters shipped with dm-core and return all adapters known to be installed on this machine' do
      storage_engines = DataMapper.available_storage_engines
      storage_engines.size.should == AVAILABLE_STORAGE_ENGINES.size
      storage_engines.each do |storage_engine|
        AVAILABLE_STORAGE_ENGINES.should include(storage_engine)
      end
    end
  end

end

# mungo:Desktop snusnu$ spec -cfs storage_engine_reflection.rb
#
# DataMapper storage engine reflection:  DataMapper.storage_engine_available?(name)
# - should return true for adapters known to be installed on this machine
#
# DataMapper storage engine reflection:  DataMapper.available_storage_engines
# - should try all adapters shipped with dm-core and return all adapters known to be installed on this machine
#
# Finished in 0.002688 seconds
#
# 2 examples, 0 failures</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/05/07/datamapper-storage-engine-reflection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>#validatable? should work on a belongs_to association</title>
		<link>http://sick.snusnu.info/2009/04/30/validatable-should-work-on-a-belongs_to-association/</link>
		<comments>http://sick.snusnu.info/2009/04/30/validatable-should-work-on-a-belongs_to-association/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 19:44:13 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/30/validatable-should-work-on-a-belongs_to-association/</guid>
		<description><![CDATA[The following ONLY APPLIES to datamapper-0.9.x, datamapper-0.10.0 doesn&#8217;t have this problem anymore

require "rubygems"
require "dm-core"
require "dm-validations"
require "spec"

DataMapper.setup(:default, "sqlite3::memory:")

class Person
  include DataMapper::Resource
  property :id, Serial
  has 1, :profile
  has n, :project_memberships
  has n, :projects, :through =&#62; :project_memberships
end

class Profile
  include DataMapper::Resource
  property :id, Serial
  property :person_id, Integer, :nullable =&#62; false
 [...]]]></description>
			<content:encoded><![CDATA[<p>The following ONLY APPLIES to datamapper-0.9.x, datamapper-0.10.0 doesn&#8217;t have this problem anymore</p>
<pre name="code" class="ruby">
require "rubygems"
require "dm-core"
require "dm-validations"
require "spec"

DataMapper.setup(:default, "sqlite3::memory:")

class Person
  include DataMapper::Resource
  property :id, Serial
  has 1, :profile
  has n, :project_memberships
  has n, :projects, :through =&gt; :project_memberships
end

class Profile
  include DataMapper::Resource
  property :id, Serial
  property :person_id, Integer, :nullable =&gt; false
  belongs_to :person
end

class Project
  include DataMapper::Resource
  property :id, Serial
  has n, :tasks
end

class ProjectMembership
  include DataMapper::Resource
  property :id, Serial
  property :person_id, Integer, :nullable =&gt; false
  property :project_id, Integer, :nullable =&gt; false
  belongs_to :person
  belongs_to :project
end

class Task
  include DataMapper::Resource
  property :id, Serial
  property :project_id, Integer, :nullable =&gt; false
  belongs_to :project
end

describe "Resource#validatable?" do

  before(:all) do
    DataMapper.auto_migrate!
  end

  describe "when called directly on a Resource" do
    it "should return true if dm-validations are present" do
      Person.create.should be_validatable
      Profile.create.should be_validatable
      Project.create.should be_validatable
      ProjectMembership.create.should be_validatable
    end
  end

  describe "when called on an DataMapper::Associations::ManyToOne::Proxy" do

    it "should return true if dm-validations are present" do
      person  = Person.create
      project = Project.create
      membership = ProjectMembership.create :person =&gt; person, :project =&gt; project
      membership.person.should be_validatable
      membership.project.should be_validatable
    end

  end

  describe "when called on an DataMapper::Associations::OneToMany::Proxy" do

    describe "that points to a Resource related with has(n)" do

      it "should return true if dm-validations are present" do
        p = Project.create
        t = Task.create :project_id =&gt; p.id
        p.reload
        p.tasks.all? { |task| task.validatable? }.should be_true
      end

    end

    describe "that points to a Resource related with has(n, :through)" do

      it "should return true if dm-validations are present" do
        person  = Person.create
        project = Project.create
        membership = ProjectMembership.create :person =&gt; person, :project =&gt; project
        person.reload
        person.projects.all? { |p| p.validatable? }.should be_true
      end

    end

  end

end

# mungo:Desktop snusnu$ spec -c -f -s validatable.rb
#
# Resource#validatable? when called directly on a Resource
# - should return true if dm-validations are present
#
# Resource#validatable? when called on an DataMapper::Associations::ManyToOne::Proxy
# - should return true if dm-validations are present (FAILED - 1)
#
# Resource#validatable? when called on an DataMapper::Associations::OneToMany::Proxy that points to a Resource related with has(n)
# - should return true if dm-validations are present
#
# Resource#validatable? when called on an DataMapper::Associations::OneToMany::Proxy that points to a Resource related with has(n, :through)
# - should return true if dm-validations are present
#
# 1)
# 'Resource#validatable? when called on an DataMapper::Associations::ManyToOne::Proxy should return true if dm-validations are present' FAILED
# expected validatable? to return true, got false
# ./validatable.rb:67:
#
# Finished in 0.028411 seconds
#
# 4 examples, 1 failure</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/30/validatable-should-work-on-a-belongs_to-association/feed/</wfw:commentRss>
		</item>
		<item>
		<title>extlib/hook breaks if hooked method is redefined</title>
		<link>http://sick.snusnu.info/2009/04/29/extlibhook-breaks-if-hooked-method-is-redefined/</link>
		<comments>http://sick.snusnu.info/2009/04/29/extlibhook-breaks-if-hooked-method-is-redefined/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 03:35:54 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[extlib]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/29/extlibhook-breaks-if-hooked-method-is-redefined/</guid>
		<description><![CDATA[
require "rubygems"
require "dm-core"
require "spec"

DataMapper.setup(:default, "sqlite3::memory:")

class Person

  include DataMapper::Resource

  property :id, Serial

  before :save, :shower
  after  :save, :shave

  def shower
    @showered = true
  end

  def shave
    @shaved = true
  end

  def showered?
    @showered
  end

  def [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
require "rubygems"
require "dm-core"
require "spec"

DataMapper.setup(:default, "sqlite3::memory:")

class Person

  include DataMapper::Resource

  property :id, Serial

  before :save, :shower
  after  :save, :shave

  def shower
    @showered = true
  end

  def shave
    @shaved = true
  end

  def showered?
    @showered
  end

  def shaved?
    @shaved
  end

end

describe "Hooking Resource#save" do

  before(:all) do
    DataMapper.auto_migrate!
  end

  describe "when the hooked method DOES CALL super" do

    before(:each) do
      class Person
        def save(context = nil)
          super(context)
        end
      end
    end

    it_should_behave_like "hooks"

  end

  describe "when the hooked method DOES NOT CALL super" do

    before(:each) do
      class Person
        def save(context = nil)
          true
        end
      end
    end

    it_should_behave_like "hooks"

  end

  describe "hooks", :shared =&gt; true do

    it "should preserve established before and after hooks" do
      p = Person.new
      p.should_not be_showered
      p.should_not be_shaved
      p.save
      p.should be_showered
      p.should be_shaved
    end

  end

end

# mungo:Desktop snusnu$ spec -c -f -s freak.rb
#
# Hooking Resource#save when the hooked method DOES CALL super
# - should preserve established before hooks
#
# Hooking Resource#save when the hooked method DOES NOT CALL super
# - should preserve established before hooks (FAILED - 1)
#
# 1)
# 'Hooking Resource#save when the hooked method DOES NOT CALL super should preserve established before hooks' FAILED
# expected showered? to return true, got nil
# ./freak.rb:76:
#
# Finished in 0.007412 seconds
#
# 2 examples, 1 failure</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/29/extlibhook-breaks-if-hooked-method-is-redefined/feed/</wfw:commentRss>
		</item>
		<item>
		<title>datamapper and inflection of the english word address</title>
		<link>http://sick.snusnu.info/2009/04/20/datamapper-and-inflection-of-the-english-word-address/</link>
		<comments>http://sick.snusnu.info/2009/04/20/datamapper-and-inflection-of-the-english-word-address/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 01:51:01 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/20/datamapper-and-inflection-of-the-english-word-address/</guid>
		<description><![CDATA[
require 'rubygems'

gem 'dm-core', '=0.9.12'
gem 'rspec'

require 'dm-core'
require "spec"

#DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite3:memory:')

Extlib::Inflection.rule 'ess', 'esses'
Extlib::Inflection.singular_word("address", "address")

class Person
  include DataMapper::Resource
  property :id, Serial
  has n, :addresses, :through => Resource
end

class Address
  include DataMapper::Resource
  property :id, Serial
end

describe "Inflection of 'Address'" do

  it "should work in DataMapper.auto_migrate!" do
    lambda { DataMapper.auto_migrate! }.should_not raise_error
  [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
require 'rubygems'

gem 'dm-core', '=0.9.12'
gem 'rspec'

require 'dm-core'
require "spec"

#DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite3:memory:')

Extlib::Inflection.rule 'ess', 'esses'
Extlib::Inflection.singular_word("address", "address")

class Person
  include DataMapper::Resource
  property :id, Serial
  has n, :addresses, :through => Resource
end

class Address
  include DataMapper::Resource
  property :id, Serial
end

describe "Inflection of 'Address'" do

  it "should work in DataMapper.auto_migrate!" do
    lambda { DataMapper.auto_migrate! }.should_not raise_error
  end

end

# mungo:Desktop snusnu$ spec -c -f -s address.rb
#
# Inflection of 'Address'
# - should work in DataMapper.auto_migrate!
#
# Finished in 0.040151 seconds
#
# 1 example, 0 failures
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/20/datamapper-and-inflection-of-the-english-word-address/feed/</wfw:commentRss>
		</item>
		<item>
		<title>textmate rspec bundle (datamapper) helpers</title>
		<link>http://sick.snusnu.info/2009/04/09/textmate-rspec-bundle-datamapper-helpers/</link>
		<comments>http://sick.snusnu.info/2009/04/09/textmate-rspec-bundle-datamapper-helpers/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 15:51:35 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[rspec]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/09/textmate-rspec-bundle-datamapper-helpers/</guid>
		<description><![CDATA[I found that I often want to add debug outputs to the specs while working on them. Since I use textmate&#8217;s rspec bundle to run (focused) unit tests, I needed my debug messages to be html. Here&#8217;s what I came up with
http://gist.github.com/92470
]]></description>
			<content:encoded><![CDATA[<p>I found that I often want to add debug outputs to the specs while working on them. Since I use<a href="http://www.robbyonrails.com/articles/2007/02/12/rspec-bundle-for-textmate"> textmate&#8217;s rspec bundle</a> to run (focused) unit tests, I needed my debug messages to be html. Here&#8217;s what I came up with</p>
<p><a href="http://gist.github.com/92470">http://gist.github.com/92470</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/09/textmate-rspec-bundle-datamapper-helpers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>dm-accepts_nested_attributes</title>
		<link>http://sick.snusnu.info/2009/04/08/dm-accepts_nested_attributes/</link>
		<comments>http://sick.snusnu.info/2009/04/08/dm-accepts_nested_attributes/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 18:43:39 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/08/dm-accepts_nested_attributes/</guid>
		<description><![CDATA[I just pushed http://github.com/snusnu/dm-accepts_nested_attributes/tree/master
It&#8217;s probably not quite complete yet, but it&#8217;s already reasonably specced and functional.

254 examples, 0 failures
89.7%   3 file(s)   473 Lines   234 LOC

Current status:

 belongs_to: create / destroy / update


 has(1): create / update/ destroy


has(n): create / update / destroy


has(n, :through): create / update / destroy

Also, since [...]]]></description>
			<content:encoded><![CDATA[<p>I just pushed <a href="http://github.com/snusnu/dm-accepts_nested_attributes/tree/master" target="_blank" rel="nofollow">http://github.com/snusnu/dm-accepts_nested_attributes/tree/master</a></p>
<p>It&#8217;s probably not quite complete yet, but it&#8217;s already reasonably specced and functional.</p>
<pre>
254 examples, 0 failures
89.7%   3 file(s)   473 Lines   234 LOC</pre>
<p><strong><br />
Current status:</strong></p>
<ul>
<li> <strong>belongs_to</strong>: <font color="#008000">create</font> / <font color="#008000">destroy</font> / <font color="#008000">update</font></li>
</ul>
<ul>
<li> <strong>has(1)</strong>: <font color="#008000">create</font> / <font color="#008000">update</font>/ <font color="#008000">destroy</font></li>
</ul>
<ul>
<li><strong>has(n)</strong>: <font color="#008000">create</font> / <font color="#008000">update</font> / <font color="#008000">destroy</font></li>
</ul>
<ul>
<li><strong>has(n, :through)</strong>: <font color="#008000">create</font> / <font color="#008000">update</font> / <font color="#008000">destroy</font></li>
</ul>
<p>Also, since I need this rather soon for my current (<a href="http://merbivore.com">merb</a>) project, I wrote it for <a href="http://github.com/datamapper/dm-core/tree/0.9.11">0.9.11</a> I definitely want it to be available for next branch (of course) but I cannot spend any time on it now, since from what I read, the <a href="http://github.com/datamapper/dm-core/tree/next">datamapper next branch</a> is not production ready yet.</p>
<p>Anyways, I think it&#8217;d be really cool to have this in <a href="http://datamapper.org/doku.php">datamapper</a>! (a plugin is perfeclty fine, needn&#8217;t be core). The <a href="http://github.com/rails/rails/commits/master/activerecord/lib/active_record/nested_attributes.rb">API</a> is almost the same (one minor change for now - have a look at the README) like the one activerecord has, which should mean, that once <a href="http://rubyonrails.org/">rails3</a> comes out, multimodel forms are totally possible with <a href="http://datamapper.org/doku.php">datamapper</a> as ORM.</p>
<p>As for <a href="http://merbivore.com">merb</a>, I don&#8217;t really know if it has support for nested model assignment in its <em>form_for</em> and <em>fields_for</em> helpers. I have to say though, that I don&#8217;t really care, since I don&#8217;t use these helpers, but write the html that my designer colleague wants to see.</p>
<p>Any help, ideas, discussions on irc/email, forks, patches, whatever &#8230; really appreciated!</p>
<p><font color="#008000"><u><strong>UPDATE 12</strong></u></font></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/2118726746a5ff92ddce9bb87af124a77dc55508">This commit</a> added initial support for transactions. Currently, every call to save gets wrapped inside a transaction. However,there is still some work to do to make this solid. It&#8217;s also totally not specced atm.</p>
<p><font color="#008000"><u><strong>UPDATE 11</strong></u></font></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/abdc211fde4f03dabec45ff49d97490686ce39ac">This commit</a> added a hook to allow to sanitize nested model attributes that get passed to a resource. See <a href="http://groups.google.com/group/rubyonrails-core/browse_thread/thread/a56e144e7e871b60">this thread</a> on the <a href="http://groups.google.com/group/rubyonrails-core">rails-core</a> list for the motivation behind this new method. Currently the method doesn&#8217;t do anything, but can be overwritten to perform just the amount of sanitization that you would like to apply.</p>
<p><u><strong><font color="#008000">UPDATE 10</font></strong></u></p>
<p>With <a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/4c5e65662edb1991decbcb3783aedc3e065d4d09">this patch</a> from Rupert Voelcker, it is now possible to access the nested attributes also after <em>Resource#save</em> was called. This means that if for example a controller&#8217;s <em>create action</em> needs to redirect to the <em>new action</em> because the resource couldn&#8217;t be saved, the values the user previously entered can be displayed on the <em>new form</em>, just as you would expect. Thx again Rupert!</p>
<p><u><strong><font color="#008000">UPDATE 9</font></strong></u></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/32dcfe84d977be68c38b64cdb691b3ff221358f7">This commit</a> added (experimental) support for <a href="http://github.com/datamapper/dm-more/tree/a9d77793620f36938eaa94da60f6a262a78838ab/dm-validations">dm-validations</a>. More details explaining the current status and TODO list can be found in my <a href="http://groups.google.com/group/datamapper/browse_thread/thread/8e78b785b6dff9f0">post</a> to the <a href="http://groups.google.com/group/datamapper/">datamapper mailinglist </a></p>
<p><u><strong><font color="#008000">UPDATE 8</font></strong></u></p>
<p><a href="http://github.com/rupert/dm-accepts_nested_attributes/tree/master">Rupert Voelcker</a> sent a <a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/4e204a1c6891437a40afd5c6a2adf600787e29cb">patch</a> that allows <em>renamed</em> has(n, :through, :class_name, :child_key, :parent_key) associations to work with <a href="http://github.com/snusnu/dm-accepts_nested_attributes/tree/master">dm-accepts_nested_attributes</a>. Thx a lot!</p>
<p><u><strong><font color="#008000">UPDATE 7</font></strong></u></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/b45ea52dc538309567b8b5542b932d3df83007c2">This commit</a> added a new helper method for many_to_one (belongs_to) and one_to_one (has 1) associations, that will return either the associated record (if present) or a new record of the associated class. This is somehow close to activerecords build_association, I guess, but it differs in that it won&#8217;t build a new record in case that one is already associated. For this reason, I named it <em>get_#{association}.</em> It isn&#8217;t available for _to_many associations, since datamapper already provides <em>get</em> and <em>build</em> methods on their association proxy.</p>
<p>After I added this method, I read through <a href="http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes">Ryan&#8217;s Scraps</a> again, and got reminded of his cool trick to achieve the same thing I&#8217;m trying to do with view helpers (I mainly added this feature to support <em>fields_for</em> a nested attribute). I totally agree when he says that it&#8217;s actually a view concern to prepare the resource for form submission, and I&#8217;m now thinking that I will maybe remove this added feauture from <a href="http://sick.snusnu.info/2009/04/08/dm-accepts_nested_attributes/">dm-accepts_nested_attributes</a></p>
<p><font color="#008000"><u><strong>UPDATE 6</strong></u></font></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/bd6dfe6d90b05f9184b2a2799b3d4f04b0afea94">This commit </a>added the possibility to specify a <em>reject_if proc</em> that gets passed all attributes. If the proc returns true, the creation of a new associated entry will be rejected. Now, <a href="http://github.com/snusnu/dm-accepts_nested_attributes/tree/master">dm-accepts_nested_attributes</a> supports the same features as activerecord nested attribute assignment (I think).</p>
<p><strong><u><font color="#008000">UPDATE 5</font></u></strong></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/b0fcf441654e0831f8d4a5a072c69bf7fdd84ec6">This commit</a> added the possibility to <em>update has(n, :through)</em> associations via <em>#{association_name}_attributes=</em></p>
<p>This means that all (current) specs pass and everything works so far :) Hooray!</p>
<p><u><strong><font color="#008000">UPDATE 4</font></strong></u></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/a8ba5f68318ee23f96e876dcb4692fcbb6945843">This commit</a> added the possibility to <em>destroy has(n, :through)</em> associations via <em>#{association_name}_attributes=</em></p>
<p><u><strong><font color="#008000"> UPDATE 3 </font></strong></u></p>
<p><a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/1efbb4c2fe085e771c54ecc0ebcda837dbf17e7a">This commit</a> added the possibility to <em>create has(n, :through)</em> associations via <em>#{association_name}_attributes=</em></p>
<p><u><strong><font color="#008000">UPDATE 2</font></strong></u></p>
<p>It seems to me that <a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/2783be5124f860cd3779e3d746fcb3e31dff2920">this commit</a> fixes the issue mentioned in <em>UPDATE 1</em> since the new code should behave the same as dm-core-0.9.11 does if the association to be saved <em>does not accept_nested_attributes</em></p>
<p><font color="#ff0000"><u><strong>UPDATE 1 </strong></u></font></p>
<p>In order to get <em>update</em> working for <em>belongs_to</em>, <em>has(1)</em> and <em>has(n)</em>, I commented out <a href="http://github.com/datamapper/dm-core/blob/7a3802e3e883fd8d07e430065f609f572f364476/lib/dm-core/associations/many_to_one.rb#L61">a line of dm-core-0.9.11</a> code which doesn&#8217;t seem to have too many effects. I ran the specs for 0.9.11 with <a href="http://github.com/snusnu/dm-accepts_nested_attributes/commit/69eb9ff9b55eb90b2e847b4a250722212f43a130">this</a> change incorporated, and mostly mocks(!) that expect the method call that i commented, fail. However, there is also one <strong>stack level too deep</strong> error Now, I don&#8217;t really know if this means that something else is broken really badly now, or if this can be worked around. The new failing dm-core specs after this commit are:</p>
<p>1)<br />
SystemStackError in &#8216;DataMapper::Associations one to many associations #&lt;&lt; should add the correct number of elements if they are created&#8217;<br />
stack level too deep<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/repository.rb:41:in `scope&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core.rb:181:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/support/kernel.rb:6:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/relationship.rb:172:in `with_repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/one_to_many.rb:298:in `save_resource&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/one_to_many.rb:210:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/one_to_many.rb:309:in `send&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/one_to_many.rb:309:in `method_missing&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/one_to_many.rb:210:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/resource.rb:301:in `hookable__save_nan_before_advised&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/resource.rb:301:in `each&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/resource.rb:301:in `hookable__save_nan_before_advised&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/many_to_one.rb:64:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/relationship.rb:172:in `with_repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/support/kernel.rb:6:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core.rb:181:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/repository.rb:44:in `scope&#8217;</p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>2)<br />
Spec::Mocks::MockExpectationError in &#8216;DataMapper::Associations::ManyToOne::Proxy#save when the parent is not a new record should not save the parent&#8217;<br />
#&lt;ManyToOneSpec::Parent:0&#215;1159388&gt; expected :save with (no args) 0 times, but received it once<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/many_to_one.rb:64:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/relationship.rb:172:in `with_repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/support/kernel.rb:6:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core.rb:181:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/repository.rb:44:in `scope&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core.rb:181:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/support/kernel.rb:6:in `repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/relationship.rb:172:in `with_repository&#8217;<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/many_to_one.rb:63:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/spec/integration/associations/many_to_one_spec.rb:116:</p>
<p>11)<br />
Spec::Mocks::MockExpectationError in &#8216;DataMapper::Associations::ManyToOne::Proxy#save when the parent is not a new record should not save the parent&#8217;<br />
Mock &#8216;relationship&#8217; received unexpected message :with_repository with (#&lt;Spec::Mocks::Mock:0&#215;217d426 @name=&#8221;parent&#8221;&gt;)<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/many_to_one.rb:63:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/spec/unit/associations/many_to_one_spec.rb:91:</p>
<p>12)<br />
Spec::Mocks::MockExpectationError in &#8216;DataMapper::Associations::ManyToOne::Proxy#save when the parent is not a new record should return true&#8217;<br />
Mock &#8216;relationship&#8217; received unexpected message :with_repository with (#&lt;Spec::Mocks::Mock:0&#215;216d9cc @name=&#8221;parent&#8221;&gt;)<br />
/Users/snusnu/projects/github/dm-core/lib/dm-core/associations/many_to_one.rb:63:in `save&#8217;<br />
/Users/snusnu/projects/github/dm-core/spec/unit/associations/many_to_one_spec.rb:95:</p>
<p>13)<br />
Spec::Mocks::MockExpectationError in &#8216;DataMapper::Associations::ManyToOne::Proxy#save when the parent is a new record should save the parent&#8217;<br />
Mock &#8216;parent&#8217; expected :new_record? with (no args) once, but received it 0 times<br />
/Users/snusnu/projects/github/dm-core/spec/unit/associations/many_to_one_spec.rb:101:</p>
<p>14)<br />
Spec::Mocks::MockExpectationError in &#8216;DataMapper::Associations::ManyToOne::Proxy#save when the parent is a new record should return the result of the save&#8217;<br />
Mock &#8216;parent&#8217; expected :new_record? with (no args) once, but received it 0 times<br />
/Users/snusnu/projects/github/dm-core/spec/unit/associations/many_to_one_spec.rb:101:</p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/08/dm-accepts_nested_attributes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>datamapper debug output in Textmate RSpec Bundle</title>
		<link>http://sick.snusnu.info/2009/04/08/datamapper-debug-output-in-textmate-rspec-bundle/</link>
		<comments>http://sick.snusnu.info/2009/04/08/datamapper-debug-output-in-textmate-rspec-bundle/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 13:51:40 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/08/datamapper-debug-output-in-textmate-rspec-bundle/</guid>
		<description><![CDATA[
# stick this in spec_helper.rb
# this will append a &#60;br /&#62; to every logged message, which produces
# nicely formatted DataMapper debug outputs in Textmate's RSpec Bundle's output

module DataMapper
  class TextmateRspecLogger &#60; Logger
    def prep_msg(message, level)
      "#{super}&#60;br /&#62;"
    end
  end
end

# comment this for [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
# stick this in spec_helper.rb
# this will append a &lt;br /&gt; to every logged message, which produces
# nicely formatted DataMapper debug outputs in Textmate's RSpec Bundle's output

module DataMapper
  class TextmateRspecLogger &lt; Logger
    def prep_msg(message, level)
      "#{super}&lt;br /&gt;"
    end
  end
end

# comment this for spec runs where you don't need to see logs
DataMapper::TextmateRspecLogger.new(STDOUT, :debug)</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/08/datamapper-debug-output-in-textmate-rspec-bundle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>case foo.class might not work like you expect</title>
		<link>http://sick.snusnu.info/2009/04/03/case-fooclass-might-not-work-like-you-expect/</link>
		<comments>http://sick.snusnu.info/2009/04/03/case-fooclass-might-not-work-like-you-expect/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 16:07:02 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[irb]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/03/case-fooclass-might-not-work-like-you-expect/</guid>
		<description><![CDATA[
irb(main):001:0> class Foo; end
=> nil
irb(main):002:0> class Bar; end
=> nil
irb(main):003:0> f = Foo.new
=> #
irb(main):004:0> case f.class
irb(main):005:1> when Foo then puts &#8220;f.class = Foo&#8221;
irb(main):006:1> when Bar then puts &#8220;f.class = Bar&#8221;
irb(main):007:1> else
irb(main):008:1*   puts &#8220;no match found&#8221;
irb(main):009:1> end
no match found
=> nil
irb(main):010:0> case f.class.name
irb(main):011:1> when &#8220;Foo&#8221; then puts &#8220;f.class.name = &#8216;Foo&#8217;&#8221;
irb(main):012:1> when &#8220;Bar&#8221; then puts &#8220;f.class.name = [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
irb(main):001:0> class Foo; end
=> nil
irb(main):002:0> class Bar; end
=> nil
irb(main):003:0> f = Foo.new
=> #<Foo:0x8d3d8>
irb(main):004:0> case f.class
irb(main):005:1> when Foo then puts &#8220;f.class = Foo&#8221;
irb(main):006:1> when Bar then puts &#8220;f.class = Bar&#8221;
irb(main):007:1> else
irb(main):008:1*   puts &#8220;no match found&#8221;
irb(main):009:1> end
no match found
=> nil
irb(main):010:0> case f.class.name
irb(main):011:1> when &#8220;Foo&#8221; then puts &#8220;f.class.name = &#8216;Foo&#8217;&#8221;
irb(main):012:1> when &#8220;Bar&#8221; then puts &#8220;f.class.name = &#8216;Bar&#8217;&#8221;
irb(main):013:1> else
irb(main):014:1*   puts &#8220;no match found&#8221;
irb(main):015:1> end
f.class.name = &#8216;Foo&#8217;
=> nil
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/03/case-fooclass-might-not-work-like-you-expect/feed/</wfw:commentRss>
		</item>
		<item>
		<title>dm-is-cloneable</title>
		<link>http://sick.snusnu.info/2009/04/01/dm-is-cloneable/</link>
		<comments>http://sick.snusnu.info/2009/04/01/dm-is-cloneable/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 03:30:58 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/04/01/dm-is-cloneable/</guid>
		<description><![CDATA[I just pushed dm-is-cloneable.
 A DataMapper plugin that adds the ability to clone any model. As this alone wouldn’t really be a big deal, it is also possible to specifiy a 1:n relation with so called clone_specs. In these, the attributes_to_clone are persisted, thus leaving clients with the choice of selecting predefined sets of attributes [...]]]></description>
			<content:encoded><![CDATA[<p>I just pushed <a href="http://github.com/snusnu/dm-is-cloneable/tree/master">dm-is-cloneable</a>.</p>
<blockquote><p> A DataMapper plugin that adds the ability to clone any model. As this alone wouldn’t really be a big deal, it is also possible to specifiy a 1:n relation with so called clone_specs. In these, the attributes_to_clone are persisted, thus leaving clients with the choice of selecting predefined sets of attributes to clone. Currently, associated objects don&#8217;t get cloned, although this might change if I need this in the future.</p></blockquote>
<p>Client code looks something like this:</p>
<pre name="code" class="ruby">

require 'rubygems'

gem 'dm-core',         '=0.9.11'
gem 'dm-validations',  '=0.9.11'
gem 'dm-is-remixable', '=0.9.11'
gem 'dm-is-cloneable', '=0.0.1'

require 'dm-core'
require 'dm-validations'
require 'dm-is-remixable'
require 'dm-is-cloneable'

DataMapper::Logger.new(STDOUT, :debug)

DataMapper.setup(:default, 'sqlite3:memory:')

class Item

  include DataMapper::Resource

  property :id,             Serial
  property :master_item_id, Integer # add this property if backlinks are desired

  property :name,           String
  property :description,    String

  is :cloneable

  # adds the following api to this class
  #
  # # attributes_to_clone can be one of
  # # &lt;:all|String|Array[String|Symbol]|ItemCloneSpec&gt;
  # Item#clone_resource(nr_of_clones, attributes_to_clone = :all)
  # Item#master_resource
  # Item#cloned_resources
  # Item#has_backlinks_to_master?
  # Item#has_clone_specs?

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/04/01/dm-is-cloneable/feed/</wfw:commentRss>
		</item>
		<item>
		<title>dm-is-remixable and overwritten property accessors</title>
		<link>http://sick.snusnu.info/2009/03/31/dm-is-remixable-and-overwritten-property-accessors/</link>
		<comments>http://sick.snusnu.info/2009/03/31/dm-is-remixable-and-overwritten-property-accessors/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 02:16:28 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/03/31/dm-is-remixable-and-overwritten-property-accessors/</guid>
		<description><![CDATA[I just stumbled across some weirdness in dm-is-remixable. Seems like overwritten property writers work, whereas overwritten property readers don&#8217;t &#8230; hmm &#8230;
]]></description>
			<content:encoded><![CDATA[<p>I just stumbled across some <a href="http://pastie.org/432169" title="pastie">weirdness</a> in <a href="http://github.com/datamapper/dm-more/tree/c428cee0d9865410d2aac94b76f866afa9c4e473/dm-is-remixable" title="dm-is-remixable">dm-is-remixable</a>. Seems like overwritten property writers work, whereas overwritten property readers don&#8217;t &#8230; hmm &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/03/31/dm-is-remixable-and-overwritten-property-accessors/feed/</wfw:commentRss>
		</item>
		<item>
		<title>merb-helpers should produce valid html id attributes</title>
		<link>http://sick.snusnu.info/2009/03/25/merb-helpers-should-produce-valid-html-id-attributes/</link>
		<comments>http://sick.snusnu.info/2009/03/25/merb-helpers-should-produce-valid-html-id-attributes/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 18:40:14 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/03/25/merb-helpers-should-produce-valid-html-id-attributes/</guid>
		<description><![CDATA[A Ticket for this issue can be found here &#8230;

# stick this in init.rb's before_app_loads block
# until this issue maybe gets resolved in merb-helpers
module Merb::Helpers::Form::Builder
  class Form &#60; Base
    def update_unbound_controls(attrs, type)
      if attrs[:name] &#38;&#38; !attrs[:id]
        # this makes [...]]]></description>
			<content:encoded><![CDATA[<p>A Ticket for this issue can be found <a href="http://merb.lighthouseapp.com/projects/7433/tickets/1248-patch-merb-helpers-should-produce-valid-html-id-attributes#ticket-1248-1">here</a> &#8230;</p>
<pre name="code" class="ruby">
# stick this in init.rb's before_app_loads block
# until this issue maybe gets resolved in merb-helpers
module Merb::Helpers::Form::Builder
  class Form &lt; Base
    def update_unbound_controls(attrs, type)
      if attrs[:name] &amp;&amp; !attrs[:id]
        # this makes sure that the '[]' characters which are not valid
        # in html ids, don't get copied over. furthermore, the trailing '_'
        # character makes sure that this id stays unique (particularly
        # necessary for additionally generated hidden inputs as they
        # are generated for checkboxes for example). the 'to_s' call
        # is necessary in order for the merb testsuite to run. obviously
        # there are some tests that use the Symbol :truez as a name
        # attribute, and since Symbol#gsub is private, tests fail if the
        # name attr isn't always converted to a String before use.
        attrs.merge!(:id =&gt; attrs[:name].to_s.gsub(/(\[|\])/, '_'))
      end
      case type
      when "text", "radio", "password", "hidden", "checkbox", "file"
        add_css_class(attrs, type)
      end
      super
    end
  end
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/03/25/merb-helpers-should-produce-valid-html-id-attributes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>working with UTC and datamapper</title>
		<link>http://sick.snusnu.info/2009/02/23/working-with-utc-and-datamapper/</link>
		<comments>http://sick.snusnu.info/2009/02/23/working-with-utc-and-datamapper/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 14:48:58 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/02/23/working-with-utc-and-datamapper/</guid>
		<description><![CDATA[

  # stick this in the before_app_loads block in init.rb
  # if this maybe finds its way into dm-more, this wouldn't be necessary anymore

  module DataMapper
    module Types

      class UtcDateTime &#60; DataMapper::Type

        primitive DateTime

    [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">

  # stick this in the before_app_loads block in init.rb
  # if this maybe finds its way into dm-more, this wouldn't be necessary anymore

  module DataMapper
    module Types

      class UtcDateTime &lt; DataMapper::Type

        primitive DateTime

        def self.load(v, property)
          if v.nil?
            nil
          elsif v.is_a?(DateTime)
            ::DateTime.new(v.year, v.month, v.day, v.hour, v.min, v.sec, 0)
          else
            raise ArgumentError.new("+value+ must be nil or a DateTime")
          end
        end

        def self.dump(v, property)
          if v.nil?
            nil
          elsif v.is_a?(String)
            Time.parse(v).utc.to_datetime
          elsif v.is_a?(DateTime)
            Time.parse(v.to_s).utc.to_datetime
          else
            raise ArgumentError.new("+value+ must be nil or a String or a DateTime")
          end
        end

      end # class UtcDateTime

      UTCDateTime = UtcDateTime

    end # module Types
  end # module DataMapper

  module DataMapper
    module Timestamp

      def set_timestamps
        return unless dirty? || new_record?
        TIMESTAMP_PROPERTIES.each do |name,(_type,proc)|
          if model.properties.has_property?(name)
            self.send("#{name}=", proc.call(self, model.properties[name]))
          end
        end
      end

      def utc_timestamped?
        self.class.utc_timestamped?
      end

      module ClassMethods

        def timestamps(*names)
          raise ArgumentError, 'You need to pass at least one argument' if names.empty?

          # if the last element in names is a Hash:
          # extract this hash and look for a :utc key
          opts = names.last.is_a?(Hash) ? names.pop : nil
          utc_possible = names.include?(:created_at) || names.include?(:updated_at)
          @utc = opts &amp;&amp; opts[:utc] &amp;&amp; utc_possible

          names.each do |name|
            case name
              when *TIMESTAMP_PROPERTIES.keys
                type = TIMESTAMP_PROPERTIES[name].first
                property name, type, :nullable =&gt; false, :auto_validation =&gt; false

                if type == DateTime &amp;&amp; @utc # UTC makes no sense for Date
                  define_method "#{name}=", UTC::PROPERTY_WRITER.call(name, type)
                  define_method "#{name}",  UTC::PROPERTY_READER.call(name, type)
                end

              when :at
                timestamps(:created_at, :updated_at, :utc =&gt; @utc)
              when :on
                timestamps(:created_on, :updated_on) # UTC makes no sense for Date
              else
                raise InvalidTimestampName, "Invalid timestamp property name '#{name}'"
            end
          end
        end

        def utc_timestamped?
          !!@utc
        end

      end

      module UTC
        PROPERTY_WRITER = lambda { |name, type|
          typecast = "to_#{type.name.downcase}"
          lambda { |dt| attribute_set(name, Time.parse(dt.to_s).utc.send(typecast)) }
        }
        PROPERTY_READER = lambda { |name, type|
          lambda {
            return nil unless dt = attribute_get(name)
            if type == Date
              Date.new(dt.year, dt.month, dt.day, 0)
            elsif type == DateTime
              DateTime.new(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec, 0)
            else
              nil
            end
          }
        }
      end

    end
  end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/02/23/working-with-utc-and-datamapper/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I HATE WORKING WITH DATE AND DATETIME AND TIME</title>
		<link>http://sick.snusnu.info/2009/02/16/i-hate-working-with-date-and-datetime-and-time/</link>
		<comments>http://sick.snusnu.info/2009/02/16/i-hate-working-with-date-and-datetime-and-time/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 20:33:04 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/02/16/i-hate-working-with-date-and-datetime-and-time/</guid>
		<description><![CDATA[seriously, i do &#8230;.
]]></description>
			<content:encoded><![CDATA[<p><strong>seriously, i do &#8230;.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/02/16/i-hate-working-with-date-and-datetime-and-time/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ruby method calls with heredoc parameter and block</title>
		<link>http://sick.snusnu.info/2009/02/07/ruby-method-calls-with-heredoc-parameter-and-block/</link>
		<comments>http://sick.snusnu.info/2009/02/07/ruby-method-calls-with-heredoc-parameter-and-block/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 15:32:11 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/02/07/ruby-method-calls-with-heredoc-parameter-and-block/</guid>
		<description><![CDATA[This is taken from here and serves mainly as a reminder for myself.

  dbh.execute(&#60;&#60;-STMT) { &#124;sth&#124;
      select distinct customer, business_unit_id, business_unit_key_name
       from problem_ticket_lz
       order by customer
    STMT
    sth.fetch { &#124;row&#124;
  [...]]]></description>
			<content:encoded><![CDATA[<p>This is taken from <a href="http://www.michaelnygard.com/blog/2009/02/combining_here_docs_and_blocks.html">here</a> and serves mainly as a reminder for myself.</p>
<pre name="code" class="ruby">
  dbh.execute(&lt;&lt;-STMT) { |sth|
      select distinct customer, business_unit_id, business_unit_key_name
       from problem_ticket_lz
       order by customer
    STMT
    sth.fetch { |row|
      print "#{row[1]}\t#{row[0]}\t#{row[2]}\n"
    }
  }</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/02/07/ruby-method-calls-with-heredoc-parameter-and-block/feed/</wfw:commentRss>
		</item>
		<item>
		<title>sex spam</title>
		<link>http://sick.snusnu.info/2009/01/20/sex-spam/</link>
		<comments>http://sick.snusnu.info/2009/01/20/sex-spam/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 12:02:46 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[sex spam]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/01/20/sex-spam/</guid>
		<description><![CDATA[&#8220;Even Godzilla was never this huge&#8221;
]]></description>
			<content:encoded><![CDATA[<blockquote>&#8220;Even Godzilla was never this huge&#8221;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/01/20/sex-spam/feed/</wfw:commentRss>
		</item>
		<item>
		<title>sharing common properties between datamapper models</title>
		<link>http://sick.snusnu.info/2009/01/17/sharing-common-properties-between-datamapper-models/</link>
		<comments>http://sick.snusnu.info/2009/01/17/sharing-common-properties-between-datamapper-models/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 21:23:49 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2009/01/17/sharing-common-properties-between-datamapper-models/</guid>
		<description><![CDATA[
require "rubygems"
require "dm-core"

module Locatable

  # using a lambda instead of self.included(base) class_eval hack
  # to add properties and/or associations that are shared by many models
  #
  # use this module in two steps.
  #
  # 1) eval the lambda with property definitions in class scope
  #   [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
require "rubygems"
require "dm-core"

module Locatable

  # using a lambda instead of self.included(base) class_eval hack
  # to add properties and/or associations that are shared by many models
  #
  # use this module in two steps.
  #
  # 1) eval the lambda with property definitions in class scope
  #   class_eval &amp;Locatable::PROPERTIES
  #
  # 2) include the common instance methods if any
  #   include Locatable
  #
  # this also makes it possible, that this module gets included at a different
  # time (place in code) than the property definitions, which might come in
  # handy in situations where you deal with overriding methods with/from
  # this module (say you want to establish aliases for methods that only get
  # added by some calls to belongs_to or has or the likes)

  PROPERTIES = lambda do
    property :location_id, Integer, :nullable =&gt; false
  end

  ASSOCIATIONS = lambda do
    belongs_to :location
  end

  # common instance methods

  # need to support different protocol
  # for whatever reason ...
  alias :information :description

  def latitude
    location.latitude
  end

  def longitude
    location.longitude
  end

  # ...

end

class Item

  include DataMapper::Resource

  # properties

  property :id, Serial
  property :owner_id, Integer, :nullable => false

  # using the lambda here makes it very explicit what's going on.
  # it also allows to preserve the property order in the underlying
  # table definition in a natural and consistent way.
  class_eval &amp;Locatable::PROPERTIES

  property :name,         String
  property :description, Text

  # associations

  # again, using the lambda here makes it very explicit what's going on.
  class_eval &#038;Locatable::ASSOCIATIONS

  belongs_to :owner
  has n, :item_categories
  has n, :categories, :through => :item_categories

  # include Locatable methods after #description exists
  # we want to support the alias

  include Locatable

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2009/01/17/sharing-common-properties-between-datamapper-models/feed/</wfw:commentRss>
		</item>
		<item>
		<title>default ordering with datamapper</title>
		<link>http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/</link>
		<comments>http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 12:09:08 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/</guid>
		<description><![CDATA[Thanks to Adam French for this tip on the datamapper mailinglist.
You&#8217;d essentially be update&#8217;ing the default query object that all
calls to all() and first() start off with before applying the user&#8217;s
parameters

class Post
 include DataMapper::Resource
 #... other properties here
 default_scope(:default).update(:order =&#62; [:created_at.desc])
end
]]></description>
			<content:encoded><![CDATA[<p>Thanks to Adam French for this tip on the <a href="http://datamapper.org/doku.php?id=docs">datamapper</a> <a href="http://groups.google.com/group/datamapper">mailinglist</a>.</p>
<blockquote><p>You&#8217;d essentially be update&#8217;ing the default query object that all<br />
calls to all() and first() start off with before applying the user&#8217;s<br />
parameters</p></blockquote>
<pre name="code" class="ruby">
class Post
 include DataMapper::Resource
 #... other properties here
 default_scope(:default).update(:order =&gt; [:created_at.desc])
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/12/10/default-ordering-with-datamapper/feed/</wfw:commentRss>
		</item>
		<item>
		<title>datamapper stand alone script (for bugreports)</title>
		<link>http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/</link>
		<comments>http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 23:50:07 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/</guid>
		<description><![CDATA[
#!/usr/bin/env ruby

require 'rubygems'

gem 'dm-core', '~&#62;0.9.8'
require 'dm-core'

DataMapper::Logger.new(STDOUT, :debug)
# DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)

DataMapper.setup(:default, 'sqlite3::memory:')

# here come the demo class(es)

DataMapper.auto_migrate!

# here comes initial creation of records if necessary

puts '-' * 80

# here comes the demo code demonstrating the error or whatever
]]></description>
			<content:encoded><![CDATA[<pre name="code" class="ruby">
#!/usr/bin/env ruby

require 'rubygems'

gem 'dm-core', '~&gt;0.9.8'
require 'dm-core'

DataMapper::Logger.new(STDOUT, :debug)
# DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)

DataMapper.setup(:default, 'sqlite3::memory:')

# here come the demo class(es)

DataMapper.auto_migrate!

# here comes initial creation of records if necessary

puts '-' * 80

# here comes the demo code demonstrating the error or whatever</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/12/10/datamapper-stand-alone-script-for-bugreports/feed/</wfw:commentRss>
		</item>
		<item>
		<title>relevant merb / datamapper ticket information</title>
		<link>http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/</link>
		<comments>http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 17:14:27 +0000</pubDate>
		<dc:creator>Martin Gamsjäger</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[datamapper]]></category>

		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/</guid>
		<description><![CDATA[When filing a ticket for merb or datamapper, it&#8217;s a good idea to put the following information into the ticket
(Suggested by Dan Kubb - dkubb in #datamapper)

uname -a (for unixes at least)
ruby --version
mysql --version (or the equivalent for your db)
gem list '\A(?:(?:d[mo]&#124;merb)[_-]&#124;data_?(?:mapper&#124;objects)&#124;extlib)'

]]></description>
			<content:encoded><![CDATA[<p>When filing a ticket for <a href="http://merbivore.com">merb</a> or <a href="http://datamapper.org/doku.php">datamapper</a>, it&#8217;s a good idea to put the following information into the ticket<br />
(Suggested by Dan Kubb - dkubb in #datamapper)</p>
<pre>
uname -a (for unixes at least)
ruby --version
mysql --version (or the equivalent for your db)
gem list '\A(?:(?:d[mo]|merb)[_-]|data_?(?:mapper|objects)|extlib)'
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sick.snusnu.info/2008/12/02/relevant-merb-datamapper-ticket-information/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
