I have a Person model with attributes first_name and last_name.

I want to implement autocomplete search that looks that the entire
name. Hence I have a method:

def full_name
   self.first_name + " " + self.last_name
end

Is it possible for me to query on full_name and have rails match the
first_name and last_name fields?

I currently receive this error when I try, because full_name isn't an
attribute in the database:

SQLite3::SQLException: no such column: full_name: SELECT
"people".* FROM       "people"  WHERE     (LOWER(full_name) LIKE 'he
%') ORDER BY  full_name ASC LIMIT 10

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to