using ActiveRecord outside of rails

Showing 1-8 of 8 messages
using ActiveRecord outside of rails peter cowan 12/22/11 4:31 PM
hi pdx rubyists,

i'm doing a little side project in ruby and i need to add persistence to one object. i'm leaning towards just using ActiveRecord because it is familiar and i think i might one day use this project with rails, but i've also got a nagging feeling that there might be a better way, plus what if i decide to go with sinatra over rails? also, i hoping to avoid anything as low level as the DBI module. 

any thoughts?  

-peter

Re: [pdxruby-beginners] using ActiveRecord outside of rails Sam Livingston-Gray 12/22/11 5:40 PM
There's nothing wrong with using ActiveRecord outside of Rails, and it's fairly straightforward to use with Sinatra as well. The real danger with it is that, like any ORM, it encourages you to think of your object in terms of database tables, which can inhibit design.

--
(Sent from phone; please excuse brevity.)

Re: [pdxruby-beginners] using ActiveRecord outside of rails Allen Goodman 12/22/11 10:34 PM
Hi Peter,

While I'd agree with Sam's premonition, *some* of the design
constraint can be neutralized by using a non-ActiveRecord patterned
ORM. For example, traversing complex object graphs with DataMapper
(datamapper.org) is trivial. Moreover, since DataMapper constructs
your database schema from your models, it's possible to obviate
migrations. This is an especially useful feature while prototyping.

Best,
Allen

Re: [pdxruby-beginners] using ActiveRecord outside of rails Sam Livingston-Gray 12/22/11 11:10 PM
Though it's worth pointing out that DataMapper actually implements the Active Record (note the space) pattern. ;)

--
(Sent from phone; please excuse brevity.)

Re: [pdxruby-beginners] using ActiveRecord outside of rails Jesse Cooke 12/23/11 12:49 AM

I've used both Datamapper & Mongoid in Sinatra apps with nice results. Depending on what this app is doing you might give it a whirl in MagLev.

Re: [pdxruby-beginners] using ActiveRecord outside of rails peter cowan 12/23/11 10:41 AM
cool. in this case the object really just needs to represent the corresponding table, so the are no design conflicts in going with ActiveRecord.

Allen thanks for pointing out DataMapper, looks like the inverse of ActiveRecord in some ways.

Jesse, the app is going to download ~2 million nonprofit records from the IRS website, pipe them into a database, geocode the addresses, and then the web front end will provide a nice search/map interface. i am leaning towards rails because I have yet to see a ruby job posting that does not say something like "you can make rails bend to you will", and so even though i prefer the simplicity of sinatra for such a small project, i feel i should experience bending rails to my will at least once.
Re: [pdxruby-beginners] using ActiveRecord outside of rails Sam Livingston-Gray 12/23/11 9:22 PM
I've been itching to play with MagLev. Any resources I should look at?


--
(Sent from phone; please excuse brevity.)
Re: [pdxruby-beginners] using ActiveRecord outside of rails Jesse Cooke 12/23/11 9:53 PM

So far the best ones are in the examples dir & the few things I've done for the group.

@jc00ke
n-tier engineer