From 803ef74f9bbcbc71af12060157a996f7b65e24db Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Tue, 24 Feb 2015 22:22:15 +0100 Subject: [PATCH] Tiny documentation edits [ci skip] --- activerecord/lib/active_record/associations.rb | 4 +--- .../connection_adapters/abstract/schema_statements.rb | 2 +- guides/source/association_basics.md | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 0b33ee881b..cecb2dbd0b 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1019,7 +1019,7 @@ def association_instance_set(name, association) # can affect what it does. # # Note that :dependent option is ignored for +has_one+ :through associations. - # + # # === Delete or destroy? # # +has_many+ and +has_and_belongs_to_many+ associations have the methods destroy, @@ -1529,8 +1529,6 @@ def has_one(name, scope = nil, options = {}) # NOTE: required is set to true by default and is deprecated. If # you don't want to have association presence validated, use optional: true. # - # - # # Option examples: # belongs_to :firm, foreign_key: "client_of" # belongs_to :person, primary_key: "name", foreign_key: "person_name" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 0438c95bd7..d42f9a894b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -770,7 +770,7 @@ def remove_foreign_key(from_table, options_or_to_table = {}) # # Check a foreign key exists # foreign_key_exists?(:accounts, :branches) # - # # Check a foreign key on specified column exists + # # Check a foreign key on a specified column exists # foreign_key_exists?(:accounts, column: :owner_id) # # # Check a foreign key with a custom name exists diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 0079049d44..d6b2e75e1e 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -959,7 +959,8 @@ If you set the `:validate` option to `true`, then associated objects will be val ##### `:optional` -If you set the `:optional` option to `true`, then associated object will be validated for presence. By default, this is `false`: associated objects will be validated for presence. +If you set the `:optional` option to `true`, then the presence of the associated +object won't be validated. By default, this option is set to `false`. #### Scopes for `belongs_to`