Skip to content

stungeye/ActiveRecord-without-Rails

Repository files navigation

Active Record Without Rails

Some simple ruby script that make use of ActiveRecord CRUD tasks outside of Rails.

CRUD stands for Create, Read, Update and Delete. These are the typical operations that we perform on data in a database.

Before you continue you should read the official Rails guide on Active Record Basics.

Each one of these following scripts depends on the ar.rb file to load up the database connection. The following four scripts show how to perform CRUD on data in a customers table using a Customer mode.

In a database we can relate data across different tables using foreign key associations. Here's an example of an association where each row in the customers table "belongs to" a row in the provinces table by way of a province_id foreign key:

Active Record Resources

Thanks

This code was heavily inspired by Luiz Cezer's Active-Record-and-Migrations-without-Rails.

License

This is free and unencumbered software released into the public domain. See UNLICENSE for details.

About

ActiveRecord CRUD tasks using Ruby (without Rails)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages