Plugin working locally But not in live

(Vinoth Kannan) #1

Continuing the discussion from Timeline - Social Network like News Feed UI in Topic List:

My above plugin working perfectly on localhost as it in screenshots. But I can’t see any updates in live website.

Looks like below code is not working. I am not getting unread_post field in latest.json response.

I can see the plugin name in both plugins list and upgrade pages.

(Vinoth Kannan) #2

I just fixed it myself :slight_smile:

Timeline - News Feed UI in Topic List View
(Sam Saffron) #3

What was wrong? :bug:

(Vinoth Kannan) #4

@sam TopicListItemSerializer is inherited class of ListableTopicSerializer. If I monkey patch ListableTopicSerializer it is not working on live version. Instead if I monkey patch TopicListItemSerializer it is working on both local and live. Weird :flushed:

Inconsistent behaviour in plugins between development and production
(Sam Saffron) #5

wow, strange, maybe the serializer was being patched too late in the process after it already cached certain data.

(Vinoth Kannan) #6

Yes. I think so. May be eager_load or cache_classes doing that part.

(David Taylor) #9

I just spent a long time debugging an issue caused by this. I was doing

add_to_serializer(:admin_user, :somefield)...

which worked fine in development, but not in production. Changing it to :admin_detailed_user fixed the problem (admin_detailed_user inherits from admin_user).

It would be good if we can either fix this, or at least add a warning. Differences between dev/prod are painful!

(Sam Saffron) #10

100% in agreement here :heart: if you can figure out any way to make this explode consistently on both prod and dev it would be awesome… My guess is that this is somehow related to the reloaders.

One sad thing about relying on “reload” magic is that there is a lot of magic. Its one big reason we moved away from using sprockets (and never jumped on the spring train) … it just got too hard to fit the mold of reloading without side effects.

(this could be not reload related, but hey, its a nice story :crazy_face: )