2007-10-26 01:56:46 -04:00
|
|
|
class Parrot < ActiveRecord::Base
|
2011-11-29 10:34:22 -05:00
|
|
|
self.inheritance_column = :parrot_sti_class
|
|
|
|
|
2007-10-26 01:56:46 -04:00
|
|
|
has_and_belongs_to_many :pirates
|
|
|
|
has_and_belongs_to_many :treasures
|
2007-11-20 16:53:22 -05:00
|
|
|
has_many :loots, :as => :looter
|
2008-08-15 21:49:22 -04:00
|
|
|
alias_attribute :title, :name
|
2009-01-31 20:44:30 -05:00
|
|
|
|
|
|
|
validates_presence_of :name
|
2010-01-08 14:47:49 -05: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 01:56:46 -04:00
|
|
|
end
|
2007-11-26 17:46:11 -05:00
|
|
|
|
|
|
|
class LiveParrot < Parrot
|
|
|
|
end
|
|
|
|
|
|
|
|
class DeadParrot < Parrot
|
|
|
|
belongs_to :killer, :class_name => 'Pirate'
|
|
|
|
end
|