Merge branch 'master' of github.com:atomaka/find-us-lunch
This commit is contained in:
commit
2665250d32
2 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue