1
0
Fork 0

Merge branch 'master' of github.com:atomaka/find-us-lunch

This commit is contained in:
Andrew Tomaka 2014-11-20 15:51:49 -05:00
commit 2665250d32
2 changed files with 3 additions and 1 deletions

View file

@ -1,6 +1,6 @@
class UsersController < ApplicationController class UsersController < ApplicationController
def index def index
@users = User.all @users = User.all_except(current_user)
end end
def show def show

View file

@ -2,6 +2,8 @@ class User < ActiveRecord::Base
has_many :friendships has_many :friendships
has_many :friends, through: :friendships has_many :friends, through: :friendships
scope :all_except, ->(user) { where.not(id: user) }
def self.from_omniauth(auth) def self.from_omniauth(auth)
where(provider: auth[:provider], uid: auth[:uid]).first_or_create do |user| where(provider: auth[:provider], uid: auth[:uid]).first_or_create do |user|
user.provider = auth[:provider] user.provider = auth[:provider]