diff --git a/src/db_models.rb b/src/db_models.rb index 20b5b22..820ae0b 100644 --- a/src/db_models.rb +++ b/src/db_models.rb @@ -1,6 +1,18 @@ -class TableModel +class TableModel # Base model attr_reader :table_name def initialize(table_name) @table_name = table_name end + + private def get(entity, filter="") + db = db_handle # get the db handle + query = "SELECT #{entity} FROM #{@table_name} " # create the query string + if filter != "" then query += "WHERE #{filter}" end + + db.execute query + end +end + + +class User < TableModel end