module RailsCoreExtensions module ActionViewExtensions def textilize(content) super(h(content)).html_safe end # Will recursively parse a Hash and any sub hashes to be normal hashes # This is useful when exporting hashes to non ruby systems, which don't understand HashWithIndifferentAccess def hashify(element) if element.is_a? Hash element = element.to_hash if element.is_a?(HashWithIndifferentAccess) element.each_pair do |key, value| element[key] = hashify(value) end else # Must hashify enumerables encase their sub items are hashes # Can't enumerate through string as it returns strings, which are also enumerable (stack level too deep) if element.respond_to?(:each) && !element.is_a?(String) element.map{ |sub| hashify(sub) } else element end end end # Generates a tooltip with given text # text is textilized before display def tooltip(hover_element_id, text, title='') content = "