Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
class Attachment < ActiveRecord::Base belongs_to :attachable, :polymorphic => :true validates_presence_of :width, :height, :if => Proc.new { |attachment| ["Photo", "Logo"].include? attachment.attachable_type } end class Asset < ActiveRecord::Base has_one :attachment, :as => :attachable end class Photo < Asset end class Logo < Asset end class Video < Asset end
This paste will be private.
From the Design Piracy series on my blog: