I’m using the rails3-jquery-autocomplete gem to autocomplete the name of a user, search attribute is lastname but I want to display full name as the display value. Here’s what I have in my controller
autocomplete :customer, :lastname, :display_value => :display_autocomplete
Customer Model
def display_autocomplete
self.firstname + ' ' + self.lastname
end
Error:
ActiveModel::MissingAttributeError (missing attribute: firstname):
You need to get the extra data, like so: