title: Include arbitrary field in Rails model JSON output
body: <p>I'm using Rails as a REST server, and one of my models has a description field. In that model's JSON representation, I need to output both the regular description field AND an arbitrary non-DB attribute called description_markdown that is just the description run through a markdown filter. I already know how to run text through markdown using redcarpet, like:</p>
  
  <pre><code>@post = Post.find(params[:id])
  markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink =&gt; true, :space_after_headers =&gt; true, :fenced_code_blocks =&gt; true, :lax_html_blocks =&gt; true)
  description_markdown = markdown.render(@post.description).html_safe
  </code></pre>
  
  <p>But what I really need is to make <code>description_markdown</code> an attribute on @post (like @post.description_markdown), and have it output in @post's JSON representation. </p>