Stop Rails Console from barfing a ton of data
When you use Rails’ console for stuff like this:
people.each { |person| puts person.name }
You’ll notice that first you get the names of people like you wanted, but then console barfs out the array of everything you are iterating through, in this case all of the people. Make it stop.
Comments
I’ve also been known to use ‘;0’. E.g.:
people.each { person puts person.name };0Please stop spamming rubyflow with nonsense like this.
This is great on heroku console as well.
http://www.youtube.com/watch?v=-f_DPrSEOEo
puts people.map(&:name)is a better shortcut.Really? There is a blog post on this? You people need to learn ruby and it’s tools before acting like experts. You look foolish!
Post a comment