我正在使用rails3-jquery-autocomplete gem来自动填充用户名,搜索属性是姓,但我想显示全名作为显示值 . 这是我在控制器中的内容
autocomplete :customer, :lastname, :display_value => :display_autocomplete
客户模型
def display_autocomplete
self.firstname + ' ' + self.lastname
end
错误:
ActiveModel::MissingAttributeError (missing attribute: firstname):
1 回答
您需要获取额外的数据,如下所示: