All Projects → amatsuda → arel_ruby

amatsuda / arel_ruby

Licence: MIT License
ARel Ruby visitor

Programming Languages

ruby
36898 projects - #4 most used programming language

ArelRuby

ARel Ruby visitor

Installation

Add this line to your application's Gemfile:

gem 'arel_ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install arel_ruby

Usage

This gem adds to_ruby method onto ARel. The to_ruby method transforms ARel AST into pure Ruby Enumerable manipulations, so that you can execute queries without using any RDBMS engine. Try this on your Rails app and you will realize what's actually gonna happen.

YourActiveRecordModel.where(name: 'foo').to_ruby.to_source
YourActiveRecordModel.order('id').to_ruby.to_source
YourActiveRecordModel.offset(10).limit(5).to_ruby.to_source
YourActiveRecordModel.group('created_at').to_ruby.to_source

Examples

See examples directory

Contributing

Fork and PR

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].