title: Rails ActiveRecord object not saving
body: <p>I have this table that stores serialized objects:</p>
  
  <pre><code>class CachedObject &lt; ActiveRecord::Base
    attr_accessible :key, :data
    validates_uniqueness_of :key
  end
  </code></pre>
  
  <p>The data column stores a serialized object indexed by key.  Pretty simple.  I'm running this code to test:</p>
  
  <pre><code>key = "test"
  obj = {"test" =&gt; "test"}
  row = CachedObject.find_or_create_by_key key
  row.data = obj.to_json
  row.save
  </code></pre>
  
  <p>The object is getting created, but it's not saving back to the database.  No error messages.  What am I doing wrong here?</p>