Hi,
Have an issue with the rails auto complete, it works fine but I don''t
know how to find the id element search in the textfield.
Here is what I''ve done:
<%= text_field_with_auto_complete :user, :ville_name, { :size => 15 },
{ :url => formatted_villes_path(:js), :method => :get, :param_name =>
''search'' } %>
Model:
class User < ActiveRecord::Base
attr_accessible :email, :ville_id, :newsletters, :role, :gender,
:first_name, :last_name, :birth_date
serialize :newsletters
has_one :ville
GENDERS = %w(Homme Femme)
ROLES = %w(Admin Business User)
def full_name
[@first_name, @last_name].join('' '')
end
def ville_name
ville.name if ville
end
def ville_name=(name)
self.ville = Ville.find_or_create_by_name(name) unless name.blank?
end
end
I want to find the "ville" ID typed in the auto complete field.
Greg
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.