2007-11-26 22:45:43 +00:00
|
|
|
class Ship < ActiveRecord::Base
|
|
|
|
self.record_timestamps = false
|
2009-02-01 01:44:30 +00:00
|
|
|
|
2009-11-06 22:53:33 +00:00
|
|
|
belongs_to :pirate
|
2009-02-01 01:44:30 +00:00
|
|
|
has_many :parts, :class_name => 'ShipPart', :autosave => true
|
|
|
|
|
2009-02-08 13:23:35 +00:00
|
|
|
accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? }
|
2009-02-01 01:44:30 +00:00
|
|
|
|
|
|
|
validates_presence_of :name
|
2009-02-08 13:23:35 +00:00
|
|
|
end
|