aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/Rakefile
diff options
context:
space:
mode:
authorVladimir Rybas <vladimirrybas@gmail.com>2015-07-30 22:04:28 +0700
committerVladimir Rybas <vladimirrybas@gmail.com>2015-07-30 22:04:28 +0700
commit4ec818d28c3984ec9d27c362fc8ff48af9335cde (patch)
treec931bd3bba1a6b7d90d2c10beffd134fc514e63e /activemodel/Rakefile
parent70009e31005220ddacce0a27a2908858be268a0a (diff)
downloadrails-4ec818d28c3984ec9d27c362fc8ff48af9335cde.tar.gz
rails-4ec818d28c3984ec9d27c362fc8ff48af9335cde.tar.bz2
rails-4ec818d28c3984ec9d27c362fc8ff48af9335cde.zip
RDoc: fix wrong model name `:inverse_of` with `:belongs_to` [ci skip]
There's a typo in ActiveRecord associations RDocs. Wrong `Taggable` model name, instead of `Tagging` in example of using option `:inverse_of` with `:belongs_to` association. Commit where typo was introduced: https://github.com/rails/rails/commit/91fd6510563f84ee473bb217bc63ed598abe3f24#diff-39001423802a8470dba9c931e66e101eR11 First it appears in `activerecord/CHANGELOG` in example of `:inverse_of` usage: ```ruby class Post < ActiveRecord::Base has_many :taggings has_many :tags, :through => :taggings end class Tagging < ActiveRecord::Base belongs_to :post belongs_to :tag, :inverse_of => :tagging # :inverse_of must be set! end class Tag < ActiveRecord::Base has_many :taggings has_many :posts, :through => :taggings end post = Post.first tag = post.tags.build :name => "ruby" !> tag.save # will save a Taggable linking to the post ``` The last line should be ```ruby tag.save # will save a Tagging linking to the post ``` The same typo appears in `activerecord/lib/active_record/associations.rb`. The association name is given as `:inverse_of => :taggings`, but class name is `Taggable`. ```ruby # @post = Post.first # @tag = @post.tags.build :name => "ruby" # @tag.save # !> # The last line ought to save the through record (a <tt>Taggable</tt>). This will only work if the # <tt>:inverse_of</tt> is set: # !> # class Taggable < ActiveRecord::Base # belongs_to :post !> # belongs_to :tag, :inverse_of => :taggings # end ``` This PR fixes model name.
Diffstat (limited to 'activemodel/Rakefile')
0 files changed, 0 insertions, 0 deletions