AMS: Renaming a polymorphic type

105 views
Skip to first unread message

Ben Moss

unread,
Jan 16, 2014, 1:48:21 PM1/16/14
to rails-a...@googlegroups.com
In the app I'm working on I use a different name for a model in the API than I do in the ActiveRecord class. I am trying to serialize it as a polymorphic association, but the problem I'm having is both the sideloaded root name and the polymorphic key that gets used for its "type" both are hardcoded in AMS 0.8 to associated_object.class.to_s.

As an example (pseudocode): https://gist.github.com/benmoss/8460845. Is there any way to do what I'm looking for currently? I know there's the "root" option you can pass to associations, but that is static and I don't think would cover the "type" either.

Right now I'm accomplishing it through this monkeypatch and manually setting the AMS for the Admin model.

Ben
Reply all
Reply to author
Forward
0 new messages