Rails: Efficiently searching by both firstname and surname
问题 I'm trying to create a 'search box' that matches users by name. The difficulty is that a user has both a firstname and a surname. Each of those can have spaces in them (eg "Jon / Bon Jovi", or "Neil Patrick / Harris"), and I'm wondering about the most efficient way to ensure the search is carried out on a concatenation of both the firstname and surname fields. The list of users is quite large, so performance is a concern. I could just throw a "fullname" def in the user model, but I suspect