Created
December 20, 2012 22:21
-
-
Save apod/4349075 to your computer and use it in GitHub Desktop.
Rails: Console Tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _ 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