ruby on rails - RoR free element from array -
i have element in array such that,
[#<name id: 23, first_name: "anderson", last_name: "gorge">]
how can remove array block, want as
#<name id: 23, first_name: "anderson", last_name: "gorge">
without array block
do mean have a single element in array , want extract it? there many ways of doing it, 2 come mind are:
>> obj = [#<name id: 23, first_name: "anderson", last_name: "gorge">].first => #<name id: 23, first_name: "anderson", last_name: "gorge"> >> obj = [#<name id: 23, first_name: "anderson", last_name: "gorge">].shift => #<name id: 23, first_name: "anderson", last_name: "gorge">
Comments
Post a Comment