-
Notifications
You must be signed in to change notification settings - Fork 335
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
Change with the way associations are handled with STI that changed in v0.9.0 #505
Comments
Added a note about this change. As far as I know this wasn't necessarily an intentional change so I apologize about it breaking your API. Hopefully the note in the README helps the next person. Thanks for heads up! |
@nesquena So I have this:
But fact is an instance of InterestingFact, so I get: If i changed to
I get: Please advice? |
Maybe try this?
|
I see, so wrap it in a hash so rabl won't be confused between the field name and the if statement, right? |
That's exactly right. Admittedly confusing that it doesn't work the other way but that should fix it. On Sun, Mar 30, 2014 at 8:59 PM, Phuong Nguyen <notifications@github.com="mailto:notifications@github.com">> wrote: I see, so wrap it in a hash so rabl won't be confused between the field name and the if statement, right? — |
I'm not sure what the actual change was that made this occur, as I didn't see anything in the
CHANGELOG
that indicated that this behavior should have even happened, so I wanted to mention it here in the issue log so that the author was aware.I have a table using Single Table Inheritance (STI) in my Rails project, and the way that the label of the 'root' object for the associations between the objects changed in a way that broke our API after upgrading from RABL
0.8.6
to0.9.0
.Here is the ActiveRecord setup:
Here is the setup for the RABL view template:
With RABL
0.8.6
, the output would look like this:After upgrading RABL to
0.9.0
, the output changed so that the label for the root node of thesections
group, was now labeled'nodes'
instead of'sections'
like so:We made no change to the RABL view template, so this is a change in the way the gem behaves when handling associations that have STI like the above example. I was able to get it to revert to the
0.8.6
behavior by changing the line in the view file from this:to this:
Not a huge deal at the end of the day, but because there didn't seem to be anything mentioning this change in behavior on the
CHANGELOG
, ran into it unexpectedly and it briefly broke our API while we figured out what was going on here. Not sure if this behavior change was intentional or not, but I figured I should mention it here so you could either list this in your 'Breaking Changes' section on theREADME
or at least in theCHANGELOG
. Great gem btw!The text was updated successfully, but these errors were encountered: