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_missing
to metaprogramfind_by_
methods for model attributes - Sends SQL queries to the database using the DBConnection class
- Holds options for
primary_key
,foreign_key
andclass_name
#table_name
and#model_class
return the proper table name and model class forclass_name
- Metaprograms default options for a
belongs_to
association
- Metaprograms default options for a
has_many
association
- Allows stacking of 'where' clauses by storing query parameters
- Lazily evaluates ‘where’ clauses to reduce queries by only firing them when needed
- Uses
method_missing
to execute its stored query when an array method is called
- Sets up methods for
belongs_to
,has_many
, andhas_one_through
associations by usingsend
- Instantiates the appropriate AssociationOptions
- Implements
#where
, which returns a RecLiteRelation so that it can be stacked
- Ruby
- SQLite3
- ActiveSupport