Sean’s Obsessions

  • Archives

03 Nov

Using Rails Models from within an external script

For some one off scripts I wanted to make use of a couple of models I created. I had no idea how simple it would be to load the rails environment from within a script:


require 'config/environment.rb'
p MyModel.find(:first)

Sweet! Rails is so… thoughtful.

Leave a Reply

© 2009 Sean’s Obsessions | Entries (RSS) and Comments (RSS)

Powered by Wordpress, design by Web4Sudoku, based on Pinkline byGPS Gazette