mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-24 09:43:24 -04:00
13 lines
369 B
Ruby
13 lines
369 B
Ruby
class Photographing < ApplicationRecord
|
|
belongs_to :photo
|
|
belongs_to :photographable, polymorphic: true
|
|
|
|
def self.item(item_id, item_type)
|
|
find_by!(photographable_id: item_id, photographable_type: item_type).photographable
|
|
end
|
|
|
|
def item
|
|
find_by!(photographable_id: photographable_id, photographable_type: photographable_type).photographable
|
|
end
|
|
end
|