Sha256: 22b3bd68938a063ee2cce677e7f6838b1bdcbcce5ddf523132fe5b493c7a6168

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

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'
  has_many :treasures

  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

class FamousShip < ActiveRecord::Base
  self.table_name = 'ships'
  belongs_to :famous_pirate
  validates_presence_of :name, on: :conference
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activejob-lock-0.0.2 rails/activerecord/test/models/ship.rb
activejob-lock-0.0.1 rails/activerecord/test/models/ship.rb