lib/vundabar/orm/base_model.rb in vundabar-0.1.0 vs lib/vundabar/orm/base_model.rb in vundabar-0.2.0
- old
+ new
@@ -57,9 +57,17 @@
end
values = id ? record_values << send("id") : record_values
Database.execute_query query, values
end
+ def to_hsh
+ model_hsh = {}
+ self.class.properties.keys.each do |key|
+ model_hsh[key] = send(key)
+ end
+ model_hsh
+ end
+
alias save! save
def self.all
query = "SELECT * FROM #{table_name} "\
"ORDER BY id DESC"