I’ve use irb and console to write lots of scripts and have switched to writing single .rb files in textmate and then command+r to run it. This is really cool because I can keep all my code in one spot and just hit command+r.
So now I want it to get data from a rails app which of course has a sqlite3 database. How can I do this?
I think the easiest way to access the database from outside Rails is to use the sqlite3-ruby gem. Find documentation here.
Here is some example code copied from the link above on GitHub: