I have the following code
@asset = Asset.first(
:include => [
:asset_statuses => [
:asset_status_name,
{:asset_location => [
{:asset_floor => :asset_building}
]}
],
:asset_type => [
:asset_category => :asset_department
]
],
(probably not the best DB table desing but that's what I have to use)
The Asset.first works correctly and it brings back the data correctly but when I try to use the same :include in the to_json method it fails with the followings error:
@asset.to_json(
:include => [
:asset_statuses => [
:asset_status_name,
{:asset_location => [
{:asset_floor => :asset_building}
]}
],
:asset_type => [
:asset_category => :asset_department]
]
)
NoMethodError (undefined method `macro' for nil:NilClass):
The to_json method has the same :include syntax as find; I don't understand why it is not working.