module Gecko::LiquidCompatibility
Monkey-patches the base record class with a `to_liquid` method
Public Instance Methods
to_liquid()
click to toggle source
The Liquid templating library automatically uses a `to_liquid` method if found.
# File lib/gecko/ext/liquid_compat.rb, line 12 def to_liquid liquid_decorator.new(self) end
Private Instance Methods
liquid_decorator()
click to toggle source
If you'd like to add custom behviour per-record-type, override this method and return a subclass.
@example
module MyLiquidCompat def liquid_decorator "#{self.class.demodulized_name}Decorator".safe_constantize || BaseDecorator end end Gecko::Record::Base.include(MyLiquidCompat)
# File lib/gecko/ext/liquid_compat.rb, line 30 def liquid_decorator Gecko::BaseDecorator end