Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphic Association #47

Open
HassanJ opened this issue Sep 11, 2013 · 0 comments
Open

Polymorphic Association #47

HassanJ opened this issue Sep 11, 2013 · 0 comments

Comments

@HassanJ
Copy link

HassanJ commented Sep 11, 2013

I have been using Rabl and I thought I should give rabl-rails a try as it promises faster responses.
I am using public_activity gem which has a polymorphic belongs_to
belongs_to :trackable, :polymorphic => true

When I use child :trackable while using rabl, everything works as expected, and the key of the child object is actually the model name. But in rabl-rails the key comes as it is, i-e 'trackable' and its empty.

An example
with rable

{
    "type": "Event",
    "users": [{
        "id": 898,
    }],
    "time": "2013-09-10T15:31:12Z",
    "event": {
        "id": 27,
        "name": "Hold it",
    }
}

with rabl-rails

{
    "type": "Event",
    "users": [{
        "id": 898,
    }],
    "time": "2013-09-10T15:31:12Z",
    "trackable": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant