Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eliotsykes/rails-console-cheatsheet

Rails console cheatsheet :memo: :relaxed:
https://github.com/eliotsykes/rails-console-cheatsheet

cheatsheet rails rails-cheat-sheet rails-console ruby-on-rails

Last synced: 5 days ago
JSON representation

Rails console cheatsheet :memo: :relaxed:

Awesome Lists containing this project

README

        

# Rails Console Cheatsheet

- `rails c` starts console
- `rails db` starts db client

## `*_path` & `*_url` Route Helpers

- `app.root_path` and `app.root_url`
- `app.invoice_path` and `app.invoice_url`
- `app.engine_name.some_path` and `app.engine_name.some_url`
- `show-routes`, `show-routes -G invoice`, `help show-routes` (requires [pry-rails gem](https://github.com/rweng/pry-rails))

## ActiveRecord

- `#to_sql` outputs query, e.g. `Account.where(created_at: 1.week.ago..Time.current).to_sql`
- `show-model Account` (requires [pry-rails gem](https://github.com/rweng/pry-rails))

## Pry

- Type `help`