Here is an example:
>> tcs = TemplateCompatibility.find :all, :select => "DISTINCT id, template_id"
=> [#
If you want to extract a specific field from the above result set or an array, here in the above example i want to extract specifically template_id values, then we can use "map" method to get the values in a new array. Here is the syntax to use it with this example.
>> tcs.map(&:template_id)
=> [1, 2, 3, 4, 5, 6, 7, 4]
Enjoy Coding & hacking too!
No comments:
Post a Comment