Oh Really Magical, Tiny ORM
Yes. First create database:
psql
create database torm_development;
\c torm_development;
CREATE TABLE posts ( id integer primary key, name varchar(20), content text, author varchar(100), subject varchar(1000));
Now run tests:
bundle exec rake test
Check the model tests, to find complete list of operations.
class Post < Torm::Model
end
post = Post.new subject: 'What is RGenCG?'
post.save
first_post = Post.find(1)
puts first_post.subject
=> 'What is RGenCG?'
first_post.subject = 'What is RincCG?'
first_post.save
puts Post.find(1).subject
=> 'What is RincCG?'
Post.where(id: 1).subject
=> 'What is RincCG?'
Post.count
=> 1
Post.delete_all
Post.count
=> 0