add_to_serializer(:serializer, property) { value }
This no longer works in a production environment. It still works in a development environment.
Initially, I thought it might have something to do with the way plugin enabling is handled. As add_to_serializer’s _include? method uses the enabled? state
if define_include_method
# Don't include serialized methods if the plugin is disabled
klass.public_send(:define_method, "include_#{attr}?") { plugin.enabled? }
end
However usage of the enabled_site_setting system doesn’t seem to address the issue. Moreover, enabled? seem to still default to true anyway
def enabled?
@enabled_site_setting ? SiteSetting.get(@enabled_site_setting) : true
end
To fix the immediate issue we’ve changed the way our plugins are serializing data, however I’d like to get to the bottom of this if possible. Anyone have any ideas on what’s going on here?
This is highly unusual since we use this in polls and they are certainly not broken. The only thing I can think of is they were broken in the beta release but fixed in master? Can you try on tests-passed and see if they work?
I’ll test it further today. The usage in polls is slightly different, as the _include? method is always precluded with a third false parameter. I suspect the include? method may be the issue.
Dan is out, but essentially there are 3 different places we serialize categories with varying amounts of data. We will see if there is any way to eliminate the mixin here which makes this harder to reason about.