Active Record Outside of Rails - Setup
Sometimes it's nice to set up Active Record outside of Rails. It's really quite easy.
The above repo will get you going fast with Active Record in a Ruby app.
- Clone the repo above with
> git clone https://github.com/slindsey3000/ContactManager.git
- > bundle install
- > rake db:migrate RAILS_ENV=production
- that's it!
You can look through https://github.com/slindsey3000/ContactManager/blob/master/contact_manager.rb to see where all the action is.
The gem standalone_migrations lets you use normal migrations (like in Rails). This uses a sqlite3 db (but you could use another)
Check out Gemfile in the repo
> ruby contact_manager.rb setup // runs the program for the first time and sets up the DB (see the code)
> ruby contact_manager.rb // runs the program the rest of the time
> contacts L // When the program is running type this in to see it working (real exciting)
> contacts email LisaESauceda@armyspy.com // Type this in to see other 'features' of this program
> exit // will end the program
Really just look through the very small repo to see how it works. Have fun!