Skip to content

eliotsykes/rails-console-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

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)

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)

Pry

  • Type help

Releases

No releases published

Packages

No packages published