Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
show_simple_captcha in a liquid template
module Liquid
module Tags
module SimpleCaptcha
class HumanTest < ::Liquid::Tag
include ::ActionView::Helpers::FormTagHelper
include ::SimpleCaptcha::ViewHelper
attr_accessor :request, :session
def render(context)
controller = context.registers[:controller]
self.request = controller.request
self.session = controller.session
context.registers[:controller].send(:render_to_string, :partial => ::SimpleCaptcha.partial_path, :locals => { :registers => context.registers, :simple_captcha_options => simple_captcha_options({}) })
end
end
end
::Liquid::Template.register_tag('show_simple_captcha_tag', SimpleCaptcha::HumanTest)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment