RecLite is a lightweight ORM that implements the core functionality of ActiveRecord, including relations and associations. It was built from the ground up using Ruby.
Take a look at create_db.sql and you'll find some basic SQL for creating a database to use with RecLite. Feel free to modify it to create your own database. database.db is a prepopulated SQLite3 database, which you can delete if you want to create a new database.
To populate the database file from the SQL file, make sure you have SQLite3 installed and type sqlite3 database.db followed by .read create_db_sql into the terminal. Check the SQLite3 documentation for more detail.
- Parent class for all RecLite model objects
- Monkey patches
method_missingto metaprogramfind_by_methods for model attributes - Sends SQL queries to the database using the DBConnection class
- Holds options for
primary_key,foreign_keyandclass_name #table_nameand#model_classreturn the proper table name and model class forclass_name
- Metaprograms default options for a
belongs_toassociation
- Metaprograms default options for a
has_manyassociation
- Allows stacking of 'where' clauses by storing query parameters
- Lazily evaluates ‘where’ clauses to reduce queries by only firing them when needed
- Uses
method_missingto execute its stored query when an array method is called
- Sets up methods for
belongs_to,has_many, andhas_one_throughassociations by usingsend - Instantiates the appropriate AssociationOptions
- Implements
#where, which returns a RecLiteRelation so that it can be stacked
- Ruby
- SQLite3
- ActiveSupport