haikuwebdev (owner)

Revisions

gist: 4243 Download_button fork
public
Public Clone URL: git://gist.github.com/4243.git
Embed All Files: show embed
post_image.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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