画像の添付ファイルを処理するために ruby gem paperclip を使用しておりvalidates_attachment_content_type
、書籍モデルに追加しています。構文について質問があります。
上記を行う適切な方法はどれですか?
validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"], message: "Only jpeg, png, and gif images types are allowed"
また
validates_attachment_content_type :image, content_type: /^image\/(png|gif|jpeg|jpg)/, message: "Only jpeg, png, and gif images types are allowed"
私 (完全な初心者) には、最初のほうがよりクリーン/クリアに見えます。それとも関係ありませんか?