Dear all, I''m currently considering Rails for a quite sizeable web app - really love what I see and like Ruby a lot, and would like to work with Rails if I can. Essentially the question I''m asking is - is it possible to use Rails with an alternative ORM package / data layer to ActiveRecord, or is ActiveRecord tied into the framework so closely that this wouldn''t be practical? The reason this is a dealbreaker - we have quite a large, complex and highly normalised existing database schema. Most of the queries involve joins, often multiple joins. We have things like multi-column primary keys, 2- 3- or 4-way relations on the ''leaf'' tables, etc etc. In short, not the sort of thing that ActiveRecord copes so well with. But that''s fine, I can see the philosophy behind ActiveRecord and it looks ideal for a lot of situations, especially when the data model is simple and driven by the UI. That said, for this project I really need something a bit more powerful and a bit closer to the relational model. I''m quite prepared to write it myself if necessary, but I''m just wondering if writing an alternative data layer to use with Ruby on Rails is going to be practical, or whether I should stick to my existing Python code? -Matt
On Jun 12, 2005, at 10:21 AM, Matthew Willson wrote:> Dear all, > > I''m currently considering Rails for a quite sizeable web app - really > love what I see and like Ruby a lot, and would like to work with Rails > if I can. > > Essentially the question I''m asking is - is it possible to use Rails > with an alternative ORM package / data layer to ActiveRecord, or is > ActiveRecord tied into the framework so closely that this wouldn''t be > practical? > > The reason this is a dealbreaker - we have quite a large, complex and > highly normalised existing database schema. Most of the queries > involve joins, often multiple joins. We have things like multi-column > primary keys, 2- 3- or 4-way relations on the ''leaf'' tables, etc etc. > In short, not the sort of thing that ActiveRecord copes so well with. > > But that''s fine, I can see the philosophy behind ActiveRecord and it > looks ideal for a lot of situations, especially when the data model is > simple and driven by the UI. That said, for this project I really need > something a bit more powerful and a bit closer to the relational > model. I''m quite prepared to write it myself if necessary, but I''m > just wondering if writing an alternative data layer to use with Ruby > on Rails is going to be practical, or whether I should stick to my > existing Python code? > > -Matt >Matt, AR is highly separable from Rails, so you should be able to plug in something else if AR doesn''t suit your needs. I personally have not used another ORM with Rails, but I do use models that aren''t backed by AR all the time. If I remember right, Instiki uses Madeline backed models, and I''m sure I''ve seen others talk about using things other than AR. -Scott _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 6/12/05, Scott Barron <scott-HDQKq3lYuGDk1uMJSBkQmQ@public.gmane.org> wrote:> > On Jun 12, 2005, at 10:21 AM, Matthew Willson wrote: > > > Dear all, > > > > I''m currently considering Rails for a quite sizeable web app - really > > love what I see and like Ruby a lot, and would like to work with Rails > > if I can....> AR is highly separable from Rails, so you should be able to plug in > something else if AR doesn''t suit your needs. I personally have not > used another ORM with Rails, but I do use models that aren''t backed by > AR all the time. If I remember right, Instiki uses Madeline backed > models, and I''m sure I''ve seen others talk about using things other > than AR.One to look at is "og" that comes bundled with "nitro". I don''t know if it suits your needs as I''ve never used it but the author is quite active with maintenance and new feature releases.
Scott Barron <scott@...> writes:> AR is highly separable from Rails, so you should be able to plug in > something else if AR doesn''t suit your needs. I personally have not > used another ORM with Rails, but I do use models that aren''t backed by > AR all the time. If I remember right, Instiki uses Madeline backed > models, and I''m sure I''ve seen others talk about using things other > than AR.Ah that''s good to hear. Is there any documentation that summarises what sort of interface I''d need to provide in order to get my own setup working as a Model in Rails? For example, would I still be able to benefit from the CRUD forms / scaffolding stuff if I can provide the right interface to the ActionPack code? Apologies if this is covered on the site - I''ve found a lot on the details but all the introductory/''overview'' type material I''ve looked at seems to assume you''ll be using ActiveRecord. Cheers, Matt
Michael Campbell <michael.campbell@...> writes:> One to look at is "og" that comes bundled with "nitro". > > I don''t know if it suits your needs as I''ve never used it but the > author is quite active with maintenance and new feature releases.Ah thanks for that - yeah it looks closer to meeting my needs, but still doesn''t quite hit the mark. My ideal tool would be something that embeds (almost) the full power of the relational algebra into ruby as a mini-language, generating the necessary SQL as required. And then providing additional friendly ORM-style methods ontop of that. Something that doesn''t make any restrictions on your schema at all, but ''knows'' about foreign and primary keys and has magic to figure out joins for you from this information. Thankfully I have some Python code which does almost that, I''ll see if I can translate it to work with Rails :) -Matt