diff options
Diffstat (limited to 'activerecord/test/models/pirate.rb')
-rw-r--r-- | activerecord/test/models/pirate.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index 30545bdcd7..7cb602f445 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -1,8 +1,8 @@ class Pirate < ActiveRecord::Base belongs_to :parrot, :validate => true - belongs_to :non_validated_parrot, :class_name => 'Parrot' - has_and_belongs_to_many :parrots, -> { order('parrots.id ASC') }, :validate => true - has_and_belongs_to_many :non_validated_parrots, :class_name => 'Parrot' + belongs_to :non_validated_parrot, :class_name => "Parrot" + has_and_belongs_to_many :parrots, -> { order("parrots.id ASC") }, :validate => true + has_and_belongs_to_many :non_validated_parrots, :class_name => "Parrot" has_and_belongs_to_many :parrots_with_method_callbacks, :class_name => "Parrot", :before_add => :log_before_add, :after_add => :log_after_add, @@ -19,9 +19,9 @@ class Pirate < ActiveRecord::Base has_many :treasure_estimates, :through => :treasures, :source => :price_estimates has_one :ship - has_one :update_only_ship, :class_name => 'Ship' - has_one :non_validated_ship, :class_name => 'Ship' - has_many :birds, -> { order('birds.id ASC') } + has_one :update_only_ship, :class_name => "Ship" + has_one :non_validated_ship, :class_name => "Ship" + has_many :birds, -> { order("birds.id ASC") } has_many :birds_with_method_callbacks, :class_name => "Bird", :before_add => :log_before_add, :after_add => :log_after_add, @@ -34,7 +34,7 @@ class Pirate < ActiveRecord::Base :after_remove => proc {|p,b| p.ship_log << "after_removing_proc_bird_#{b.id}"} has_many :birds_with_reject_all_blank, :class_name => "Bird" - has_one :foo_bulb, -> { where :name => 'foo' }, :foreign_key => :car_id, :class_name => "Bulb" + has_one :foo_bulb, -> { where :name => "foo" }, :foreign_key => :car_id, :class_name => "Bulb" accepts_nested_attributes_for :parrots, :birds, :allow_destroy => true, :reject_if => proc(&:empty?) accepts_nested_attributes_for :ship, :allow_destroy => true, :reject_if => proc(&:empty?) @@ -50,7 +50,7 @@ class Pirate < ActiveRecord::Base end def reject_empty_ships_on_create(attributes) - attributes.delete('_reject_me_if_new').present? && !persisted? + attributes.delete("_reject_me_if_new").present? && !persisted? end attr_accessor :cancel_save_from_callback, :parrots_limit @@ -82,11 +82,11 @@ class Pirate < ActiveRecord::Base end class DestructivePirate < Pirate - has_one :dependent_ship, :class_name => 'Ship', :foreign_key => :pirate_id, :dependent => :destroy + has_one :dependent_ship, :class_name => "Ship", :foreign_key => :pirate_id, :dependent => :destroy end class FamousPirate < ActiveRecord::Base - self.table_name = 'pirates' + self.table_name = "pirates" has_many :famous_ships validates_presence_of :catchphrase, on: :conference end |