Skip to content

Instantly share code, notes, and snippets.

@fabrinal
Last active August 29, 2015 14:22
Show Gist options
  • Save fabrinal/2c18af240d2fee909b39 to your computer and use it in GitHub Desktop.
Save fabrinal/2c18af240d2fee909b39 to your computer and use it in GitHub Desktop.
class Photo < ActiveRecord::Base
belongs_to :photo_gallery
has_attached_file :image, :styles => {
:medium => "300x300>",
:thumb => "100x100>"
},
:path => ":rails_root/app/assets/images/photos/:style/:filename"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment