title: Rails active record query, serialized array
body: <p>Suppose I have Users data that store array of pet in String datatype</p>
  
  <pre><code>[
    #&lt;User id: 1, name: "John", pets: "---\n- cat\n- dog\n- bunny\n- ''\n"&gt;,
    #&lt;User id: 2, name: "Pete", pets: "---\n- dog\n- bunny\n- ''\n"&gt;,
    #&lt;User id: 3, name: "Jack", pets: "---\n- cat\n- ''\n"&gt;,
    #&lt;User id: 4, name: "Kurt", pets: "---\n- cat\n- bunny\n- ''\n"&gt;
  ]
  </code></pre>
  
  <p>Can i get all users that has a cat? Maybe something like <code>User.find_all_by...</code> or <code>User.where(....)</code> or anything that return as a relation? So i can order with active record query.</p>
  
  <p>I know i can get all users that has a cat with</p>
  
  <pre><code>User.all.select{|s| YAML.load(s.pets).include?'cat'}
  </code></pre>
  
  <p>, but it convert to array that cannot be ordered with active record query.</p>
  
  <p>thx for helping.</p>