diff --git a/app/controllers/changesets_controller.rb b/app/controllers/changesets_controller.rb index 3b20130d0..82966a353 100644 --- a/app/controllers/changesets_controller.rb +++ b/app/controllers/changesets_controller.rb @@ -53,7 +53,7 @@ class ChangesetsController < ApplicationController elsif @params[:bbox] changesets = conditions_bbox(changesets, BoundingBox.from_bbox_params(params)) elsif @params[:friends] && current_user - changesets = changesets.where(:user_id => current_user.friend_users.identifiable) + changesets = changesets.where(:user_id => current_user.friends.identifiable) elsif @params[:nearby] && current_user changesets = changesets.where(:user_id => current_user.nearby) end diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index f827bac3f..d4a32efb2 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -129,7 +129,7 @@ class DiaryEntriesController < ApplicationController elsif params[:friends] if current_user @title = t "diary_entries.index.title_friends" - @entries = DiaryEntry.where(:user_id => current_user.friend_users) + @entries = DiaryEntry.where(:user_id => current_user.friends) else require_user return diff --git a/app/models/user.rb b/app/models/user.rb index 36c98ed3e..284efe34e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -58,7 +58,7 @@ class User < ActiveRecord::Base has_many :new_messages, -> { where(:to_user_visible => true, :message_read => false).order(:sent_on => :desc) }, :class_name => "Message", :foreign_key => :to_user_id has_many :sent_messages, -> { where(:from_user_visible => true).order(:sent_on => :desc).preload(:sender, :recipient) }, :class_name => "Message", :foreign_key => :from_user_id has_many :friendships, -> { joins(:befriendee).where(:users => { :status => %w[active confirmed] }) } - has_many :friend_users, :through => :friendships, :source => :befriendee + has_many :friends, :through => :friendships, :source => :befriendee has_many :tokens, :class_name => "UserToken" has_many :preferences, :class_name => "UserPreference" has_many :changesets, -> { order(:created_at => :desc) } diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b9266c836..aee000a97 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -194,7 +194,7 @@ <%= content_tag "div", "", :id => "map", :class => "content_map", :data => { :user => user_data } %> <% end %> - <% friends = @user.friend_users %> + <% friends = @user.friends %> <% nearby = @user.nearby - friends %>