Displaying 1 result from an estimated 1 matches for "ville_id".
Did you mean:
file_id
2010 May 05
0
Auto_complete with has_one association
...d.
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...