title: Simple search on a Globalize3 table in Rails
body: <p>I am looking to implement a simple search function while using the globalize3 gem for Ruby on Rails.  Since the translations of the model are stored in a separate table, the code below doesn't work as there is no longer a :name field in the products table.  How can I adjust the code below to make the search function correctly?</p>
  
  <p><strong>products_controller.rb</strong></p>
  
  <pre><code> @products = Product.search(params[:search]).all
  </code></pre>
  
  <p><strong>index.html.erb</strong></p>
  
  <pre><code> &lt;%= form_tag products_path, method: :get do %&gt;   
     &lt;%= text_field_tag :search, params[:search] %&gt;
     &lt;%= submit_tag "Search", name: nil %&gt;      
   &lt;% end %&gt;
  </code></pre>
  
  <p><strong>model</strong></p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
    translates :name
    attr_accessible :name, :price, :released_at
  
    def self.search(search)
      if search
        where('name LIKE ?', "%#{search}%")
      else
        scoped
      end
    end
  end
  </code></pre>