Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prathamesh-sonpatki/torm
Tiny implmentation of ORM on top of Arel
https://github.com/prathamesh-sonpatki/torm
Last synced: 15 days ago
JSON representation
Tiny implmentation of ORM on top of Arel
- Host: GitHub
- URL: https://github.com/prathamesh-sonpatki/torm
- Owner: prathamesh-sonpatki
- License: mit
- Created: 2014-08-04T17:57:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-20T19:30:30.000Z (about 10 years ago)
- Last Synced: 2024-10-04T16:33:22.407Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 645 KB
- Stars: 12
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Torm [![Build Status](https://travis-ci.org/prathamesh-sonpatki/torm.svg?branch=master)](http://travis-ci.org/prathamesh-sonpatki/torm)
* http://github.com/prathamesh-sonpatki/torm
## DESCRIPTION
Oh Really Magical, Tiny ORM
## Does it work?
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
```## What can it do?
Check the model tests, to find complete list of operations.
## Usage
```ruby
class Post < Torm::Model
endpost = Post.new subject: 'What is RGenCG?'
post.savefirst_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
=> 1Post.delete_all
Post.count
=> 0
```