ActiveRecordLite is an object-relational mapping system inspired by ActiveRecord. Uses Ruby's metaprogramming capabilities to implement its core functionality.
SQLObject::find(id)returns a SQLObject with attributes matching the database row having the corresponding idSQLObject#insertcreates new row in the database with the SQLObject's attributes and assigns an idSQLObject#updatemaps current attribute values over previous column values in the database on the row with the corresponding idSQLObject#saveinserts or updates SQLObject based onid.nil?SQLObject#where(params)forms and executes SQL query based on params; returns an array of SQLObjectsSQLObject#belongs_to(name, options)defines a method,name, that returns a SQLObject whose#model_nameand:primary_keyvalue correspond to the:class_nameoption and:foreign_keyvalue of the associationSQLObject#has_many(name, options)is the inverse of#belongs_to; defines a method,namethat returns an array of SQLObjects with appropriate#model_names and:primary_keyvaluesSQLObject#has_one_through(name, through_name, source_name)defines a relationship between two SQLObjects through two#belongs_torelationships. Defines a method,name, that returns a SQLObject whose#model_namecorresponds to thesource_name
- Add this repo to your project
- Require
'active_record_lite'