Shopify / liquid-c

Liquid performance extension in C.
MIT License
119 stars 24 forks source link

TypeError: no _dump_data is defined for class Liquid::C::ResourceLimits #176

Open JulienItard opened 2 years ago

JulienItard commented 2 years ago

Hello there,

when I try to update to latest 4.1 i have this on my specs

     TypeError:
       no _dump_data is defined for class Liquid::C::ResourceLimits

error come from this :

Rails.cache.fetch("render_template/liquid_template/website/#{template_version}/#{name}".freeze, compress: true) do
      Liquid::Template.new.parse(body)
    end

my current version is 4.0. liquid 5.3, ruby 2.7.5, rails 5.2.7

Any idea ? Thanks !

okzea commented 1 year ago

@JulienItard To fix this error, you can define a _dump_data method for the Liquid::C::ResourceLimits class. The _dump_data method should return a string representation of the object that can be used to reconstruct the object later. Here is an example implementation:

class Liquid::C::ResourceLimits
  def _dump_data
    # return a string representation of the object
    # for example:
    "#{@limit_name}:#{@limit_value}"
  end
end

You might want to do the same with class Liquid::C::BlockBody

dylanahsmith commented 1 year ago

We never intended to support a marshal dump of the liquid-c compiled code. There were some PRs to add proper serialization and deserialization support for a use case like this, but they haven't been merged yet.