Skip to content

Instantly share code, notes, and snippets.

@apod
Created December 20, 2012 22:21
Show Gist options
  • Save apod/4349075 to your computer and use it in GitHub Desktop.
Save apod/4349075 to your computer and use it in GitHub Desktop.
Rails: Console Tips
# _ last return value
[1, 2, 3]
a = _
# avoid return value
a = (1..100000).to_a; nil
# reloading the console
reload!
# 'app' method for requests, responses, routes etc
app.get '/app.json'
app.response.body
app.some_path
# 'helper' method for all the helpers ActionView knows about
helper.truncate('Something', length: 4)
helper.link_to 'Some', app.some_path
# 'c' method for rails, rake, test commands
# https://github.com/rails/commands/
c.generate 'scaffold post title:string'
c.rake 'db:migrate'
c.test 'models/person'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment