Skip to content

Instantly share code, notes, and snippets.

@haikuwebdev
Created August 6, 2008 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haikuwebdev/4243 to your computer and use it in GitHub Desktop.
Save haikuwebdev/4243 to your computer and use it in GitHub Desktop.
class PostImage < ActiveRecord::Base
# So we can code post_image.category instead of the uglier post_image.post_image_category
belongs_to :category, :class_name => 'PostImageCategory', :foreign_key => 'post_image_category_id'
# You may want to pass other options to has_attachment.
# See the attachment_fu README.
has_attachment :content_type => :image,
:storage => :file_system,
# There is no size restriction on thumbnails.
# But you'll probably want them to fit in the TinyMCE plugin popup dialog.
:thumbnails => {:small => '124'}
validates_as_attachment
named_scope :thumbnails, :conditions => {:thumbnail => 'thumbnail'}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment