Skip to content

Commit

Permalink
Rectify rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kwizl committed May 28, 2020
1 parent 1c6628f commit b76759b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def send_button(user)
end

html = button_to title, link, class: 'btn btn-primary',
disabled: pending_friend,
data: { disabled_with: 'Pending' }
disabled: pending_friend,
data: { disabled_with: 'Pending' }
end

html.html_safe
Expand Down
10 changes: 5 additions & 5 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def friends
end

def confirm_friend(user_id)
friendship = inverse_friendships.find { |friendship| friendship.user_id == user_id && friendship.status == 'p' }
friendship&.update_attribute(:status, 'a')
friendship = inverse_friendships.find { |f| f.user_id == user_id && f.status == 'p' }
friendship.update_attribute(:status, 'a')
end

def friend?(user)
Expand All @@ -33,12 +33,12 @@ def pending_users
end

def pending_friends
friends_array = friendships.map { |friendship| friendship.friend if friendship.status == 'p' }
friends_array = friendships.map { |f| f.friend if f.status == 'p' }
friends_array.compact
end

def reject_friend(user)
friendship = inverse_friendships.find { |friendship| friendship.user == user }
friendship&.update_attribute(:status, 'r')
friendship = inverse_friendships.find { |f| f.user == user }
friendship.update_attribute(:status, 'r')
end
end

0 comments on commit b76759b

Please sign in to comment.