There are two different concepts that need to be clarified. These are 'report' and 'report definition'.
If you go to grey pages and check any of your reports, they might look like this:
{
"report" : {
"content" : {
"domains" : [],
"definitions" : [
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/1672",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/1674",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/11135",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/11146",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/11155",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/11156",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/11157",
"/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/11211"
]
},
"meta" : {
"author" : "/gdc/account/profile/18e93db4a57fba2d71f14fa6ea801d77",
"uri" : "/gdc/md/m337ddyzwudoqgiq811pfuslld7phdz1/obj/1673",
"tags" : "companya",
"created" : "2014-01-25 10:14:33",
"identifier" : "a9N6PNkSegqc",
"deprecated" : "0",
"summary" : "",
"isProduction" : 1,
"title" : "Yearly sales per office",
"category" : "report",
"updated" : "2016-02-23 12:40:18",
"contributor" : "/gdc/account/profile/ca60c2f38c6804429f9c3934ea64ea09"
}
}
}
As you can see there, there are multiple versions of this report that had been saved every time you modified your report in the past.
If you try, the way you did:
puts report.using?(attribute)
You would get TRUE if the attribute is part of any of the definitions of this report. In order to check exclusively if this attribute is part of the current/latest definition of the report you should use:
puts report.definition.using?(attribute)
Method #definition gives you the newest version of it. I hope this helps.
Raúl Melgosa