Three quick Rails console tips

Updated . Posted . Visible to the public. Repeats.
# Generate paths and URLs
> app.project_path(Project.last)
=> "/projects/34"

# Make requests
> app.get '/projects/34'
=> 200
> app.response.body
=> "<html> ..."

# Use helpers
helper.truncate("Foobar", length: 5)
=> "Fo..."
Profile picture of Henning Koch
Henning Koch
Last edit
Dominik Schöler
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2012-05-17 15:34)