Created
July 1, 2011 00:28
-
-
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
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
@@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