title: Manual parsing of ActiveRecord's error messages. How to replace template variables
body: <p>I'm using ActiveRecord with Sinatra and there's no error_messages_for helper so I have to handle it myself. It's easy to go through @model.errors object manually or just to output it with .to_json or .to_xml but errors' text contain template variables which I don't know how to get rid of. So with error text I'm recieving something like: </p>
  
  <pre><code>["username","is too short (minimum is {{count}} characters)"]
  </code></pre>
  
  <p>Where does {{count}} come from and how to replace it with the actual value?</p>