Skip to content

Instantly share code, notes, and snippets.

@ledermann
Created October 7, 2009 09:59
Show Gist options
  • Save ledermann/203930 to your computer and use it in GitHub Desktop.
Save ledermann/203930 to your computer and use it in GitHub Desktop.
# Liquid methods reflection for ActiveRecord
# Wanna know the defined liquid_methods for a given model?
#
# Example usage:
#
# class Person < ActiveRecord::Base
# liquid_methods :first_name, :last_name
# end
#
# Person.find(123).reflect_on_liquid_methods
# => ["first_name", "last_name"]
class ActiveRecord::Base
def reflect_on_liquid_methods
to_liquid.methods - Liquid::Drop.instance_methods
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment