Save typing in rails/console with this 3 packs
User rails_console_toolkit to add super-fast shortcuts to fetch records, benchmark your code, reload!
, and exit
.
Read more in the README...
Example:
# config/initializers/console.rb
RailsConsoleToolkit.model_helper 'Product', by: %i[:name, :slug]
# bin/rails console
> product('black-tshirt') # => #<Product id: 123, slug: "black-tshirt", …>
> product.slug # => "black-tshirt"
> product(456) # => #<Product id: 456, slug: "red-tshirt", …>
> product.slug # => "red-tshirt"
First add gem 'rails_console_toolkit'
to your Gemfile!
Comments
This looks very helpful. One small item. In the Readme, for each example you have the same require statement (for aliases), when I assume they should all be different.
Post a comment