0.0
No release in over 3 years
Low commit activity in last 3 years
Find your models with shortcuts. Transform numbers and arrays into AR objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 1.3.6

Runtime

>= 0
 Project Readme

RailsJazz https://www.patreon.com/igorkasyanchuk

This gem is adding shortcuts for Integer and Array classes so you can call to_XXXXX method and get object or relation object.

Usage

For example you have classes User, Company in your app.

You can do the following:

1.to_user which is equat to User.find(1) [1,2,3].to_users => User.where(id: [1,2,3])

42.to_company => Company.find(42)

Installation

gem 'just_for_fun'

And then execute:

$ bundle

Or install it yourself as:

$ gem install just_for_fun

Implementation

See lib/tasks/railtie.rb. When app is starting gem is defining such methods.

TODO

  • improve performance, looks like it has impact on it

For Rails 6

in development.rb to preload all models.

Rails.application.configure do
  config.eager_load = true
end

Contributing

You are welcome to contribute.

License

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