Using active_support to get second, third

Great post here about how to get second and third using Active Support. i.e. use

require ‘active_support/core_ext’

The moral of the tale though is that using an indexer (i.e. people[2] instead of people.third) is probably preferable apart from cases like people.first (which comes with Array anyway).

http://stackoverflow.com/questions/16821491/ruby-odd-behaviour-with-second-third-objects-in-an-array/16821624?noredirect=1#16821529

Leave a Reply

Your email address will not be published. Required fields are marked *