MiniActRecord is a customized object relational database library that facilitates the mapping of Ruby objects to their relative tables in the database. MiniActRecord abtracts away complicated SQL queries and provides an intuitive interface for users to interact with the database.
To use the library,
- Clone the repo
- Load 'pry' in the terminal
- Run
load 'demo.rb' - Test it out in pry
The database consists of the following tables:
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null |
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null |
| gym_id | integer |
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null |
| trainer_id | integer |
- Download the contents of lib folder
- Change
demo.sqlto own SQlite3 table file indb_connection.rb - Replace
demo.dbwith what you want your database file name to be indb_connection.rb
- SQLite3
- ActiveSupport::Inflector
allfirstlastwhere(params)find(params)insertupdatesavebelongs_to(name, options)has_many(name, options)has_one_through(name, through_name, source_name)has_many_through(name, through_name, source_name)