aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2015-02-18 10:47:32 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2015-02-18 10:47:32 -0200
commit28fccad2c4ca8159b1c827026cdd09de9c5a3669 (patch)
tree7b2311556b3f5ad7e9446abc777ded296d190914
parentb5ce18608edf0e55bc8a0d7d62ca703c75c7c4ef (diff)
parent6ef2ce0aedd8a61744a8b533e727b78d59184177 (diff)
downloadrails-28fccad2c4ca8159b1c827026cdd09de9c5a3669.tar.gz
rails-28fccad2c4ca8159b1c827026cdd09de9c5a3669.tar.bz2
rails-28fccad2c4ca8159b1c827026cdd09de9c5a3669.zip
Merge pull request #18984 from rousisk/master
Replace deprecated readonly option with scope blocks in docs and guide
-rw-r--r--activerecord/lib/active_record/associations.rb4
-rw-r--r--guides/source/association_basics.md5
2 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 260ef71e64..a146d78a5a 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1386,7 +1386,7 @@ module ActiveRecord
# has_one :last_comment, -> { order 'posted_on' }, class_name: "Comment"
# has_one :project_manager, -> { where role: 'project_manager' }, class_name: "Person"
# has_one :attachment, as: :attachable
- # has_one :boss, readonly: :true
+ # has_one :boss, -> { readonly }
# has_one :club, through: :membership
# has_one :primary_address, -> { where primary: true }, through: :addressables, source: :addressable
# has_one :credit_card, required: true
@@ -1514,7 +1514,7 @@ module ActiveRecord
# belongs_to :valid_coupon, ->(o) { where "discounts > ?", o.payments_count },
# class_name: "Coupon", foreign_key: "coupon_id"
# belongs_to :attachable, polymorphic: true
- # belongs_to :project, readonly: true
+ # belongs_to :project, -> { readonly }
# belongs_to :post, counter_cache: true
# belongs_to :comment, touch: true
# belongs_to :company, touch: :employees_last_updated_at
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 3484627a78..cd715aba1f 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -1986,8 +1986,8 @@ While Rails uses intelligent defaults that will work well in most situations, th
```ruby
class Parts < ActiveRecord::Base
- has_and_belongs_to_many :assemblies, autosave: true,
- readonly: true
+ has_and_belongs_to_many :assemblies, -> { readonly },
+ autosave: true
end
```
@@ -1999,7 +1999,6 @@ The `has_and_belongs_to_many` association supports these options:
* `:foreign_key`
* `:join_table`
* `:validate`
-* `:readonly`
##### `:association_foreign_key`