Markdown presenter method returning static value of markdown field


(Netzc) #1

Hello aaron,

I still have the code reloading bug happening, although the changes from 0.9.0beta3 are in place. Changes to a node’s field content are only visible in the front end when I restart the server. I tried a lot of cache related stuff, only a server restart seems to do the trick

I’m not sure what I can give you to help. What I found is, that it works when I use @node. in the node’s view, I see the changes to the field’s value I made in the backend, while if I use @., I see a stale version of the field’s value.

I’ll gladly supply logs, etc, if you let me know what you need.

Cheers,
nc

Edit: I’m running 0.9.1 on rails 5, ruby 2.3.0 on xenial.


Version 0.9.1 released
(Aaron Russell) #2

Sounds a bit different to Rails 5.0 Code reloading fails

Can I clarify what’s happening:

  1. Update the content of a node through the admin UI
  2. Reload the node url on the front end
  3. The @node variable returns the correct content
  4. The @whatever_node_name (the presenter class) variable returns the old content before you made any changes

Have I got that right?


(Netzc) #3

Spot on. Can I add that I’m very impressed with the speed of your replies!


(Aaron Russell) #4

:smile: although unfortunately I won’t be able to look in to this quite so hastily. I should be able to take a look tomorrow afternoon/evening though.

In the mean time there may be a workaround. Try explicitly generating the presenter class for the node type you’re working with. Eg:

rails g push_type:presenter whatever_node_name

Then restart the server. Let us know if that makes a difference or not as it narrows the problem down somewhat.


Multi lang support?
(Netzc) #5

Yes, after a restart changes to fields’ values are reflected on the frontend.

I understand there is some serious ruby metaprogramming going on here? I really need to brush up on this :slight_smile:

Thank you for your help, once more.


(Aaron Russell) #6

Yeah, the presenter classes are dynamically defined, unless you explicitly create one to add your own presenter logic… To be honest, it may be a bit too “magic” for some people’s tastes, so it may change in future.

I’ve moved this issue into it’s own thread and will take a look tomorrow.


(Aaron Russell) #7

@netzc I’ve just released a new gem that fixes this issue. Try version 0.9.2.

This bug was introduced a few months ago - the method defined on the presenter class was returning a static value - the markdown wasn’t being recompiled every time. This is the fix:

Thanks for spotting this and reporting this one :slight_smile:

I’ve made a few other minor improvements to the markdown field (most notably, now using codemirror to style/highlight content in the editor). There’s more to come with markdown - in future I want to the markdown field to integrate nicely with the media library, but that may be some months off right now.


(Netzc) #8

What can I say:
fixed! :clap:

Also, I love the changes to the markdown fields. in 0.9.1 I shied away from markdown fields because occasionally the markdown indentation was botched up in the admin’s form field.
This was discouraging because I had just about brought my main content author (my sister) up to speed on markdown.
Boy does she love to nest lists, which is no fun in wysiwyg.

So, @aaron, your fix is a fixer-twofer for me.