title: How to sort an array in Ruby to a particular order?
body: <p>I want to sort an array in particular order given in another array.</p>
  
  <p>EX: consider an array </p>
  
  <pre><code>a=["one", "two", "three"]
  b=["two", "one", "three"]
  </code></pre>
  
  <p>Now I want to sort array 'a' in the order of 'b', i.e  </p>
  
  <pre><code>a.each do |t|
    # It should be in the order of 'b'
    puts t
  end
  </code></pre>
  
  <p>So the output should be</p>
  
  <pre><code>two
  one 
  three 
  </code></pre>
  
  <p>Any suggestions?</p>