--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en
Wouldn't it be possible to use separate association namespaces and
include both association types for both MongoMapper and ActiveRecord
classes? Here's some quick examples
1) One-to-many MongoMapper -> ActiveRecord
class Foo < ActiveRecord::Base
many :bars
end
class Bar < MongoMapper::Document
key :foo, ActiveRecordId
end
2) One-to-many ActiveRecord -> MongoMapper
class Foo < ActiveRecord::Base
belongs_to :foo
end
class Bar < MongoMapper::Document
has_many :foos
end
3) Many-to-many ActiveRecord <->MongoMapper
class Foo < ActiveRecord::Base
many :bars, :through => :foobars
end
class Bar < MongoMapper::Document
has_many :foos
end
class Foobars < ActiveRecord::Base
belongs_to :foo
belongs_to :bar
end
In other words, add a 'many' method to ActiveRecord and use 'has_many'
on MongoMapper to refer specifically to ActiveRecord associations.
You'd probably need some magic on the 'belongs_to' method, or maybe a
different name could be used.
I could see some problems happening when chaining (foo.bar.baz.find()
where foo & bar are AR and baz is MM), but this still seems like an
interesting goal to pursue.
-Ryan
On Dec 10, 12:44 pm, John Nunemaker <nunema...@gmail.com> wrote:
> Haha. Laziness is a virtue. :)
>
Sent from my iPhone
Sent from my iPhone
On Dec 31, 2009, at 5:38 PM, Ryan Michael <ker...@gmail.com> wrote:
From what I can tell (as I said, still on the beginning of the
learning curve here), MySQL has much more robust ACID support than any
of the noSQL implementations; it doesn't seem unreasonable that some
application would benefit from fine-grained ACID support for some data
types, but be more suitable for a document store with others. And it
doesn't seem unreasonable that associations might exist between these
data types.
From what I've been reading, there seem to be a lot of people coming
to the conclusion that databases are on their way to being
increasingly specialized. It just seems like an important part of
facilitating this type of specialization is providing interfaces
between database types.
-Ryan
On Jan 1, 11:41 pm, Stephen Eley <sfe...@gmail.com> wrote:
> "A replacement for ActiveRecord" seems like a terribly limiting and
> shortsighted objective. ActiveRecord itself wasn't intended to
> "replace" anything, but to reinvent how things were done. MM will
> never really come into its own if its goal is simply to duplicate
> stuff that already exists.
>
> There's already an ActiveRecord adapter for Mongo if that's all you
> want. I'd much rather see MongoMapper pave new roads than spread a new
> layer of tar over old ones.
>
> Have Fun,
> Steve Eley - sfe...@gmail.com -http://twitter.com/SFEleyhttp://escapepod.org-http://sfeley.com
>
> On Jan 1, 2010, at 11:55 AM, Ryan Michael <keri...@gmail.com> wrote:
>
>
>
> > Also for writing extensions to projects like Radiant CMS or Spree
> > (which is what I'm working on). If the objective of MongoMapper is
> > to be a replacement for ActiveRecord, it seems like using the same
> > API as much as possible would be nice.
>
> > -Ryan
>
> > On Thu, Dec 31, 2009 at 7:50 PM, Lance Carlson
> > <lancecarl...@gmail.com> wrote:
> > The only possible merit I could see with being able to access both at
> > once is for large projects where you'd like to convert over sections
> > to mongodb or possibly the entire thing but need to do it in several
> > iterations.
>
> > Sent from my iPhone
>