I have the text_field_with_auto_complete woking on my user DB using
last_name. so looking for ‘ivanoff’ works great, but I can’t find
‘john’. Plus I like to have ‘last_name, first_name’ show up in the
dropdown.
what I can’t figure out is how to concat first_name and last_name to
make a name and use that to look it.
working code
<%= text_field_with_auto_complete :user, :last_name %>
where do I concatinate first_name and last_name to make a name?
thanks,
I understand what that does but I couldn’t get it to work.
it was looking for the ‘name’ column in the database but I followed
the examples in the book (changing the variable names where needed)
maybe my mapping isn’t right.
using this I can only look at the last name but at least the fisrt
name is now displaying. (yes I’m cringing too) I’ll get back to the
‘aggregations’ because I’d like to be able to look up by first name as
well as last name.
just one change.
from
:conditions => [“LOWER(first_name||middle_initial||last_name) LIKE ?”,
to
:conditions => [“LOWER(Concat(last_name, ', ', first_name)) LIKE ?”,