After working for a while on my first non-web based ruby project, I’ve tried to integrate nicely with a number of different components which I was already familiar with within the rails environment like ActiveRecord. Having struggled a bit with the pure approach, I wouldn’t reccomend it.

Instead, what I’m doing is just spinning up an empty rails instance and just ignoring all the web based stuff. That is, I’m not spinning up a passenger instance, my app folder is empty but I can still access everything else inside Rails like:

  • ActiveRecord
  • Migrations and rake tasks
  • ruby script/console so I can interactively poke at the db
  • ruby script/runner to spin up my server
  • All the rails based testing frameworks

So even though it’s a bit more messy, it ends up saving a lot of hassle in the long run. So much for modular design huh?

Related Posts

  1. Windows, Rails 2.2+, InstantRails & MySQL: bundled mysql.rb driver error
  2. Rails 2.0 + SWFUpload + RESTful authentication
  3. Oct 19th (day 7): Rails Rumble done
  4. Decent text editor with .rhtml/.erb syntax highlighting?
  5. Evaluating Languages
  • Why aren't you using DataMapper?

    It's specifically designed to be stand alone, and covers all of the things that you've listed there.

    I've used DM for several strictly data related tasks that range from mocking up new app model structures, or to provide access to existing databases, and a lot more.

    And there aren't any dependencies on a web application framework :)

    The syntax is negligibly different, and if you can get over the few best practice type things that DataMapperers dissuade (like STI, which they finally have relented on) then DM will do you fine.
  • Ted, that's a good point, I'll check out data mapper.
blog comments powered by Disqus