Rename ClosetList.public -> publicly_visible

This removes a conflict with a new Rails method `.public` on the model!
This commit is contained in:
Matchu 2023-07-29 11:37:46 -07:00 committed by Matchu
parent 97bf520674
commit 7edfda6d19
2 changed files with 4 additions and 2 deletions

View file

@ -86,7 +86,7 @@ class ClosetHangersController < ApplicationController
end
else
# Otherwise, default to public lists
visible_closet_lists = closet_lists.public
visible_closet_lists = closet_lists.publicly_visible
end
@closet_lists_by_owned = closet_lists.group_by(&:hangers_owned)
@visible_closet_lists_by_owned = find_closet_lists_by_owned(visible_closet_lists)

View file

@ -8,7 +8,9 @@ class ClosetList < ActiveRecord::Base
validates :hangers_owned, :inclusion => {:in => [true, false], :message => "can't be blank"}
scope :alphabetical, -> { order(:name) }
scope :public, -> { where(arel_table[:visibility].gteq(ClosetVisibility[:public].id)) }
scope :publicly_visible, -> {
where(arel_table[:visibility].gteq(ClosetVisibility[:public].id))
}
scope :visible_to, ->(user) {
condition = arel_table[:visibility].gteq(ClosetVisibility[:public].id)
condition = condition.or(arel_table[:user_id].eq(user.id)) if user