I'm using BlueCloth to create html from markdown from the content my users enter into a textarea like this:
def create
@post = Post.new(params[:post]) do |post|
body = BlueCloth.new(post.body)
post.body = body.to_html
end
...
end
This works great! I get the html stored in the database fine, But how do I show markdown in the textarea when the user edits? I tried:
def edit
@post = Post.find(params[:id])
@post.body = BlueCloth.new(@post.body)
@post.body.text
end
The output in my textarea looks like:
#<BlueCloth:0x10402d578>