У меня проблема с rabl, когда он меняет имена вложенных узлов:
Пример, вот мои цели/index.json.rabl
collection @customers => :targets
extends 'customers/profile'
А вот мои клиенты/profile.json.rabl
object @customer => :profile
attributes :id, :username, :customer_id, :first_name, :last_name, :avatar_url
Вывод при попадании в target.json (targets#index):
{
"targets": [
{
"target": {
"id": 3,
"username": null,
"first_name": "Scott",
"last_name": "Thomas",
"avatar_url": null
}
},
{
"target": {
"id": 3,
"username": null,
"first_name": "Thomas",
"last_name": "MacKay",
"avatar_url": null
}
}
]
}
Проблема в том, что я надеюсь, что «целевые» узлы в массиве «цели» будут называться «профиль». Так:
{
"targets": [
{
"profile": {
"id": 3,
"username": null,
"first_name": "Scott",
"last_name": "Thomas",
"avatar_url": null
}
},
{
"profile": {
"id": 3,
"username": null,
"first_name": "Thomas",
"last_name": "MacKay",
"avatar_url": null
}
}
]
}
Обратите внимание на узлы «профиль» вместо узлов «цель».
Как мне этого добиться?