From df629368d3cf2994e43adf470518f3397fa60474 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 29 Jul 2023 11:37:46 -0700 Subject: [PATCH] Rename ClosetList.public -> publicly_visible This removes a conflict with a new Rails method `.public` on the model! --- app/controllers/closet_hangers_controller.rb | 2 +- app/models/closet_list.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/closet_hangers_controller.rb b/app/controllers/closet_hangers_controller.rb index 089ef91f..b46e6afd 100644 --- a/app/controllers/closet_hangers_controller.rb +++ b/app/controllers/closet_hangers_controller.rb @@ -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) diff --git a/app/models/closet_list.rb b/app/models/closet_list.rb index 02f62959..dd02da61 100644 --- a/app/models/closet_list.rb +++ b/app/models/closet_list.rb @@ -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