2007-10-26 05:56:46 +00:00
|
|
|
class Parrot < ActiveRecord::Base
|
2011-11-29 15:34:22 +00:00
|
|
|
self.inheritance_column = :parrot_sti_class
|
|
|
|
|
2007-10-26 05:56:46 +00:00
|
|
|
has_and_belongs_to_many :pirates
|
|
|
|
has_and_belongs_to_many :treasures
|
2007-11-20 21:53:22 +00:00
|
|
|
has_many :loots, :as => :looter
|
2008-08-16 01:49:22 +00:00
|
|
|
alias_attribute :title, :name
|
2009-02-01 01:44:30 +00:00
|
|
|
|
|
|
|
validates_presence_of :name
|
2010-01-08 19:47:49 +00:00
|
|
|
|
|
|
|
attr_accessor :cancel_save_from_callback
|
|
|
|
before_save :cancel_save_callback_method, :if => :cancel_save_from_callback
|
|
|
|
def cancel_save_callback_method
|
|
|
|
false
|
|
|
|
end
|
2007-10-26 05:56:46 +00:00
|
|
|
end
|
2007-11-26 22:46:11 +00:00
|
|
|
|
|
|
|
class LiveParrot < Parrot
|
|
|
|
end
|
|
|
|
|
|
|
|
class DeadParrot < Parrot
|
|
|
|
belongs_to :killer, :class_name => 'Pirate'
|
|
|
|
end
|