Initial commit
This commit is contained in:
13
app/models/concerns/photoable.rb
Normal file
13
app/models/concerns/photoable.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Photoable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_many_attached :photos
|
||||
|
||||
validates :photos, content_type: ["image/png", "image/jpeg"]
|
||||
end
|
||||
|
||||
def photo
|
||||
MainPhoto.new(photos.first)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user