title: In Rails, how can I easily reset all records to the default attribute values declared in the model files?
body: <p>I have some tables that use single-table inheritance, and a considerable number of model files for each table. Each model file has some default attributes set, like this:</p>
  <pre class="lang-rb prettyprint-override"><code>class SpecialWidget &lt; Widget
    attribute :name, :string, default: &quot;A Thing&quot;
    attribute :description, :text, default: &quot;This is an awfully special widget.&quot;
  end
  </code></pre>
  <p>This is useful because in my case, the <code>name</code> and <code>description</code> are unchangeable by end users, so this is a good way for me to set values that I can still change if I need to. Now I can just do <code>SpecialWidget.create</code> all I want, and the created <code>SpecialWidget</code> will have that default <code>name</code> and <code>description</code>.</p>
  <p><strong>Now, what I want to be able to do is</strong> update the <code>name</code> or <code>description</code> of one or more types of <code>Widget</code> by changing the value in the model file, like this:</p>
  <pre class="lang-rb prettyprint-override"><code>class SpecialWidget &lt; Widget
    attribute :name, :string, default: &quot;A Thing&quot;
    attribute :description, :text, default: &quot;This is a new description for this widget.&quot;
  end
  </code></pre>
  <p>... and then running some sort of command via script or Rails console to reset every <code>Widget</code>'s <code>name</code> and <code>description</code> in the database to their default values. It should not reset values for which I haven't declared a default.</p>
  <p>This <em>must</em> be done via a default declaration in the code, and not by setting default values in the database schema, since I am using STI, and each model will have a different <code>name</code> and <code>description</code>.</p>