undefined method `addresses' for #<Elasticsearch::Model::Response::Result:0x00007f57001e5bf0>

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

undefined method `addresses' for #<Elasticsearch::Model::Response::Result:0x00007f57001e5bf0>

fugee ohu
world_controller.rb

  @users = User.search(params[:terms]).where("confirmed_at is not null")

search.html.erb

<h3><%= (t 'search_results_for') %> <%= @terms %></h3>
<ul>
 <% @users.each do |u| %>
  <li>
      <%= link_to "#{u.first_name} #{u.middle_name} #{u.last_name}", page_path(name: u.name) %>
        <% ua=u.addresses.where("current=?", true) %>
        <% if ua.country=="US" %>
            <%= ua.city %>, <%= ua.state %> <%= ISO3166::Country.find_country_by_alpha2(ua.country) %>
        <% else %>
            <%= ua.city %>, <%= ISO3166::Country.find_country_by_alpha2(ua.country) %>
        <% end %>
  </li>
 <% end %>
</ul>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/483fbefa-8bdc-41a4-b1d4-6573528a1e37%40googlegroups.com.