mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-09 08:17:58 -04:00
rubocop
This commit is contained in:
@@ -8,11 +8,9 @@ module PhotoCapable
|
||||
end
|
||||
|
||||
def remove_from_list
|
||||
photolist = self.photos.to_a # save a temp copy of the photo list
|
||||
self.photos.clear # clear relationship b/w object and photo
|
||||
photolist = photos.to_a # save a temp copy of the photo list
|
||||
photos.clear # clear relationship b/w object and photo
|
||||
|
||||
photolist.each do |photo|
|
||||
photo.destroy_if_unused
|
||||
end
|
||||
photolist.each(&:destroy_if_unused)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,6 @@ class Harvest < ActiveRecord::Base
|
||||
belongs_to :owner, class_name: 'Member'
|
||||
belongs_to :plant_part
|
||||
|
||||
|
||||
default_scope { order('created_at DESC') }
|
||||
|
||||
validates :crop, approved: true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Photo < ActiveRecord::Base
|
||||
ON_MODELS = %w(plantings harvests gardens)
|
||||
ON_MODELS = %w(plantings harvests gardens).freeze
|
||||
belongs_to :owner, class_name: 'Member'
|
||||
|
||||
ON_MODELS.each do |relation|
|
||||
@@ -13,7 +13,7 @@ class Photo < ActiveRecord::Base
|
||||
def relationships
|
||||
associations = []
|
||||
ON_MODELS.each do |association_name, _reflection|
|
||||
associations << self.send("#{association_name}").to_a
|
||||
associations << self.send(association_name.to_s).to_a
|
||||
end
|
||||
associations.flatten!
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user