Skip to content

Commit

Permalink
Make the active scope for users ensure only non_deleted users are ret…
Browse files Browse the repository at this point in the history
…urned
  • Loading branch information
phawk committed Jul 20, 2015
1 parent db89dfe commit 3e00f44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class User < ActiveRecord::Base
case_sensitive: false
}

scope :active, -> { where("users.invitation_created_at IS NULL OR users.invitation_accepted_at IS NOT NULL") }
scope :active, -> { not_deleted.where("users.invitation_created_at IS NULL OR users.invitation_accepted_at IS NOT NULL") }
scope :not_deleted, -> { where("deleted_at IS NULL") }

# Overide devise finder to lookup by username or email
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
App.emojis = <%== MultiJson.dump(Emoji.all.map(&:name)) %>;
<% end %>
<% cache User.all_cache_key do %>
App.users = <%== MultiJson.dump(ActiveModel::ArraySerializer.new(User.all, each_serializer: PublicUserSerializer, root: false), pretty: true) %>;
App.users = <%== MultiJson.dump(ActiveModel::ArraySerializer.new(User.active, each_serializer: PublicUserSerializer, root: false), pretty: true) %>;
<% end %>
</script>

Expand Down

0 comments on commit 3e00f44

Please sign in to comment.