diff --git a/Gemfile b/Gemfile index b70b131..e980654 100644 --- a/Gemfile +++ b/Gemfile @@ -19,3 +19,4 @@ gem 'bootstrap-sass', '~> 3.2.0.2' gem 'rb-readline' gem 'quiet_assets', group: :development +gem "bullet", :group => "development" diff --git a/Gemfile.lock b/Gemfile.lock index 1967c16..963c8cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,6 +31,9 @@ GEM bootstrap-sass (3.2.0.2) sass (~> 3.2) builder (3.2.2) + bullet (4.14.0) + activesupport (>= 3.0.0) + uniform_notifier (>= 1.6.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) @@ -131,12 +134,14 @@ GEM uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) + uniform_notifier (1.6.2) PLATFORMS ruby DEPENDENCIES bootstrap-sass (~> 3.2.0.2) + bullet coffee-rails (~> 4.0.0) jbuilder (~> 2.0) jquery-rails diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index 673ae10..7aa233e 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -2,7 +2,7 @@ class FriendshipsController < ApplicationController before_action :require_login def index - @friends = current_user.friends + @friendships = Friendship.includes(:friend).where(user_id: current_user.id) end def create @@ -18,8 +18,7 @@ class FriendshipsController < ApplicationController end def destroy - @friendship = Friendship.where(user_id: current_user.id, - friend_id: params[:id]).take + @friendship = Friendship.find(params[:id]) @friendship.destroy flash[:success] = 'Friend has been removed from your friends' diff --git a/app/views/friendships/index.html.erb b/app/views/friendships/index.html.erb index fbc69aa..e00e320 100644 --- a/app/views/friendships/index.html.erb +++ b/app/views/friendships/index.html.erb @@ -8,11 +8,11 @@
- <% @friends.each do |friend| %> + <% @friendships.each do |friendship| %>