Skip to content

Shorthand references to `arel_table` in ActiveRecord for lazy people, like me.

Notifications You must be signed in to change notification settings

grays/easy_arel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy Arel

With EasyArel instead of:

Thing.arel_table[:created_at]

you can say

Thing[:created_at]

EasyArel also creates class & instance methods named _ that reference your class, So in your model you can be all like

scope :recent, order(_[:created_at].desc)

You can't just use the brackets in this case, because that would just be an array. It's stupid, but I didn't feel like experimenting with any crazy operator overloading. I'm open to suggestions on making this better.

I doubt this is even a good idea, but whatever, tests pass.

About

Shorthand references to `arel_table` in ActiveRecord for lazy people, like me.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages