Skip to content

Instantly share code, notes, and snippets.

@yuki24
Created October 11, 2012 17:15
Show Gist options
  • Save yuki24/3874018 to your computer and use it in GitHub Desktop.
Save yuki24/3874018 to your computer and use it in GitHub Desktop.
a patch to get jbuilder to work with active_decorator on Rails.
# lib/jbuilder_ext/object_methods.rb
module JbuilderExt
module ObjectMethods
def __class__
(class << self; self; end).superclass
end
def is_a?(klass)
klass == __class__
end
end
end
# config/initialisers/view_template_extensions.rb
JbuilderTemplate.send(:include, JbuilderExt::ObjectMethods)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment