X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=ruby%2Flib%2Fruby%2Fgems%2F1.8%2Fgems%2Factiverecord-2.3.11%2Ftest%2Fmodels%2Fship.rb;fp=ruby%2Flib%2Fruby%2Fgems%2F1.8%2Fgems%2Factiverecord-2.3.11%2Ftest%2Fmodels%2Fship.rb;h=3da031946f0d52226a4db747d185300302c54e7e;hb=05ad905dae7df28a0baeee7739c8aab3de34c138;hp=0000000000000000000000000000000000000000;hpb=5fcbb31f4376cf38bd1745445a60d75a3758e71c;p=redminele%2Fredminele.git diff --git a/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/test/models/ship.rb b/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/test/models/ship.rb new file mode 100644 index 0000000..3da0319 --- /dev/null +++ b/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.11/test/models/ship.rb @@ -0,0 +1,19 @@ +class Ship < ActiveRecord::Base + self.record_timestamps = false + + belongs_to :pirate + belongs_to :update_only_pirate, :class_name => 'Pirate' + has_many :parts, :class_name => 'ShipPart' + + accepts_nested_attributes_for :parts, :allow_destroy => true + accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? } + accepts_nested_attributes_for :update_only_pirate, :update_only => true + + validates_presence_of :name + + attr_accessor :cancel_save_from_callback + before_save :cancel_save_callback_method, :if => :cancel_save_from_callback + def cancel_save_callback_method + false + end +end