Carson's (🚗☀☔🔑) Blog

Jun 27

Jun 9


Jun 6

May 2

Liquid::Drop method with arguments

Kind of a hack, but possible using a new stack and a variable named “args” from a filter method:

@context.stack({'args' => args}) do
    #Call to drop method
end

Related:
https://github.com/Shopify/liquid/blob/v2.5.4/lib/liquid/context.rb#L103
https://github.com/Shopify/liquid/issues/29
https://groups.google.com/forum/#!topic/liquid-templates/adH2bjH0yAE


Apr 30

Apr 29

ActiveModel::Serialization#serializable_hash Excluding Nested Attributes

For some reason, the documentation does not go into the options available for ActiveModel::Serialization#serializable_hash. Primarily, how nested attributes can be excluded via the :include option. Each nested attributes can provide a hash of options for that object. For example, if Person has an association of projects, person.serializable_hash({:include => {:projects => {:except => [:id]}}) will exclude the id attribute of from projects. These options apply to all the Rails methods that render via serializers (e.g. respond_with, render).


Apr 18

Apr 3

Mar 21

Page 1 of 7