Skip to content

Instantly share code, notes, and snippets.

Created September 22, 2008 19:41
Show Gist options
  • Save anonymous/12123 to your computer and use it in GitHub Desktop.
Save anonymous/12123 to your computer and use it in GitHub Desktop.
class Announcement < ActiveRecord::Base
has_many :scenes, :as => :scenable
validates_presence_of :title, :on => :save, :message => "can't be blank"
validates_presence_of :message, :on => :save, :message => "can't be blank"
validates_presence_of :expires_on, :on => :save, :message => "can't be blank"
class Attachment < ActiveRecord::Base
has_attachment :storage => :file_system,
:max_size => 1.megabyte,
:path_prefix => 'public/scenes'
has_many :scenes, :as => :scenable
class Website < ActiveRecord::Base
has_many :scenes, :as => :scenable
class Scene < ActiveRecord::Base
belongs_to :scenable, :polymorphic => true
validates_uniqueness_of :position, :on => :save, :message => "must be unique"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment