I have a .js.erb file and I'm trying to make it possible to write comments. I have two tabs: write and preview. When you click on 'preview' tab, markdown preview should be displayed. Now, I'm using Redcarpet and stuff from RailsCast272, so my markdown function is in application_helper.rb file:
def markdown(text)
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
return markdown.render(text).html_safe
end
How to I use it in .js.erb file and pass it a value of a tag? I get error "undefined local variable or method `markdown'"?
Thanks