title: How get autocomplete filled after an ActiveRecord Validation Error
body: <p>I'm using Rails 3.2.5 with rails3-jquery-autocomplete.
  My approach is: i have an attr_accessor called "supplier_name", and when the user fills the autocomplete and select the propper supplier, it fills the field "suplier_id" with the id of supplier.
  When i created autocomplete fields for my forms, i found an issue, every time i was editing the record, the supplier_name attr_accessor becames empty. Inspecting the code, i could see that the hidden field "supplier_id" was filled correctly.</p>
  
  <p>So, i fixed it this way, just an example:</p>
  
  <pre><code>class Invoice &lt; ActiveRecord::Base
   belongs_to :supplier
   ...
   attr_accessor :supplier_name
   attr_accessible :some_stuff, :supplier_name, :supplier_id, :some_other_stuffs
  
   validates :some_stuff, presence: true
  
   def supplier_name
    self.supplier_name.company_name unless self.new_record? rescue ""
   end
  </code></pre>
  
  <p>So, great! I Solved my issue editing BUT... If i'm creating a new record, submit, and forget to fill the field :some_stuff, the "supplier_name" will come empty, but the "supplier_id" will come correctly filled.</p>
  
  <p>So, whats the best way to solve this issue?</p>
  
  <p>Thanks for any help.</p>