Reputation:
I am using easy-autocomplete in a search form, and I would like to display both first name and last name in the suggestions list. I have the following in my search.json.jbuilder file :
json.users do
json.array!(@users) do |user|
json.name user.first_name
json.url user_path(user)
end
end
How can I modify it to add the last_name field please?
Upvotes: 0
Views: 322
Reputation: 3168
just add another entry or edit json.name
json.name "#{user.first_name} #{user.last_name}"
Upvotes: 1