Anna
Anna

Reputation: 203

read an array on ruby on rails

I'm trying to read this array on RoR:

> importer_name = [#<RouteImporter id: 1, name: "aa", filename: "aa1", type: "RouteImporter">]

I just want to get the filename character "aa1", I tried with importer_name[2] but I didn't get nothing and I don't want 'filename: "aa1"' I just want "aa1", any idea? Thanks in advance!

Upvotes: 0

Views: 126

Answers (1)

Michael Koper
Michael Koper

Reputation: 9771

you have a Ruby object stored in an array. You can access it like this(If I understand you correctly):

importer_name.first.filename

Upvotes: 2

Related Questions