aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2016-03-08 11:46:11 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2016-07-30 15:28:33 +0900
commit411e4597d552aa091cfe3dc76a83bdaffe02da1a (patch)
treea7c06d6df27915249734789f7f995b55f17e79e6 /activerecord/test/models
parent815b730b1b79158511f9f4c8465c476b9fe9b7e0 (diff)
downloadrails-411e4597d552aa091cfe3dc76a83bdaffe02da1a.tar.gz
rails-411e4597d552aa091cfe3dc76a83bdaffe02da1a.tar.bz2
rails-411e4597d552aa091cfe3dc76a83bdaffe02da1a.zip
Preserve readonly flag only for readonly association
Fixes #24093
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/post.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index bf3079a1df..2129a56075 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -24,6 +24,7 @@ class Post < ActiveRecord::Base
scope :limit_by, lambda {|l| limit(l) }
belongs_to :author
+ belongs_to :readonly_author, -> { readonly }, class_name: 'Author', foreign_key: :author_id
belongs_to :author_with_posts, -> { includes(:posts) }, :class_name => "Author", :foreign_key => :author_id
belongs_to :author_with_address, -> { includes(:author_address) }, :class_name => "Author", :foreign_key => :author_id