title: rails - get the SQL of a model save
body: <p>I need to be able to output the SQL UPDATES that would be generated by Rails, without actually running them or Saving the records.  I will be outputting the SQL updates to a file instead.</p>
  
  <p>Is there a way to do this in Rails, without using string interpolation?</p>
  
  <p>Is it possible to do something like the following:</p>
  
  <pre><code>p = Post.where (something)
  
  p.some_value = some_new_value
  
  p.to_sql??? # how to generate the update statement
  </code></pre>
  
  <p>rather than:</p>
  
  <pre><code>"UPDATE TABLE SET field_1 = #{new_field} WHERE ID = " etc etc
  </code></pre>