only allow pictures for upload
This commit is contained in:
parent
def9e6083d
commit
45146e0fbb
@ -5,5 +5,6 @@ class Picture < ApplicationRecord
|
|||||||
|
|
||||||
validates :text, length: { maximum: 80 }
|
validates :text, length: { maximum: 80 }
|
||||||
validates :happened, presence: true
|
validates :happened, presence: true
|
||||||
|
validates :picture, presence: true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -5,6 +5,7 @@ class Story < ApplicationRecord
|
|||||||
|
|
||||||
validates :text, length: { minimum: 5 , maximum: 1000 }
|
validates :text, length: { minimum: 5 , maximum: 1000 }
|
||||||
validates :header , length: { minimum: 5 , maximum: 400}
|
validates :header , length: { minimum: 5 , maximum: 400}
|
||||||
|
validates :picture, presence: true
|
||||||
|
|
||||||
def name
|
def name
|
||||||
header
|
header
|
||||||
|
@ -31,11 +31,9 @@ class PictureUploader < CarrierWave::Uploader::Base
|
|||||||
# process resize_to_fit: [50, 50]
|
# process resize_to_fit: [50, 50]
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# Add an allowlist of extensions which are allowed to be uploaded.
|
def content_type_allowlist
|
||||||
# For images you might use something like this:
|
/image\//
|
||||||
# def extension_allowlist
|
end
|
||||||
# %w(jpg jpeg gif png)
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Override the filename of the uploaded files:
|
# Override the filename of the uploaded files:
|
||||||
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||||
|
Loading…
Reference in New Issue
Block a user