Skip to content

Instantly share code, notes, and snippets.

@dreamr
Created July 1, 2011 00:28
Show Gist options
  • Save dreamr/1057625 to your computer and use it in GitHub Desktop.
Save dreamr/1057625 to your computer and use it in GitHub Desktop.
A model that can get its ORM from AR or DM - Work in progress
@@config = {
:use_adapter => :data_mapper
}
# Ideally I would like to be able to mix in ActiveRecord or DataMapper
# to get a ORM layer. Can't get ActiveRecord to work because it inherits
# rather then mixes in
class Article
def initialize(params={})
# HARD
# inherit from ActiveRecord::Base if config is :active_record
# EASY
# include DataMapper::Resource if config is :data_mapper
#HARD
# we need to be able to create one type in a test
# and then another type in another test and not have
# const collisions
super(params)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment