Project

arelable

0.0
No commit activity in last 3 years
No release in over 3 years
A ruby gem to handle ActiveRecord like Arel.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 0.5.2
~> 10.0
~> 3.0
~> 0.63.1

Runtime

 Project Readme

Arelable

Welcome to Arelable gem!

You are thinking that it is not cool to write raw SQL in Rails, aren't you?

Then just use this gem. Arelable is a simple SQL wrappers for Rails to help you not to write raw SQL, like Arel.

*Arel is not recommended to be used in your application logics because it is private method of Rails.

Installation

Add this line to your application's Gemfile:

gem 'arelable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install arelable

Usage

All you have to do is install this RubyGem! Then you can use the following feature.

gt

User.gt(:age, 35)
# => SELECT COUNT(*) FROM `users` WHERE (age > 35)

gteq

User.geteq(:age, 35)
# => SELECT COUNT(*) FROM `users` WHERE (age >= 35)

lt

User.lt(:age, 35)
# => SELECT COUNT(*) FROM `users` WHERE (age < 35)

lteq

User.lteq(:age, 35)
# => SELECT COUNT(*) FROM `users` WHERE (age <= 35)

bw

User.bw(:age, [35, 40])
# => SELECT COUNT(*) FROM `users` WHERE (age BETWEEN 35 AND 40)

matches

User.all_matches(:name, "o")
# => SELECT COUNT(*) FROM `users` WHERE (first_name LIKE '%o%')

User.forward_matches(:name, "Bo")
# => SELECT COUNT(*) FROM `users` WHERE (first_name LIKE 'Bo%')

User.backward_matches(:name, "ob")
# => SELECT COUNT(*) FROM `users` WHERE (first_name LIKE 'ob%')

Development

After checking out the repo, run bin/setup to install dependencies.

Then, create database as following.

$ mysql -u root -p
$ CREATE DATABASE areable_test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Then, run �bin/spec to run the tests.

You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/arelable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Arelable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.