mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
a1bb6c8b06
The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our Relation API is close to SQL terms I renamed `#uniq` to `#distinct`. There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue to work. I also updated the documentation to promote the use of `#distinct`.
9 lines
276 B
Ruby
9 lines
276 B
Ruby
class Book < ActiveRecord::Base
|
|
has_many :authors
|
|
|
|
has_many :citations, :foreign_key => 'book1_id'
|
|
has_many :references, -> { distinct }, :through => :citations, :source => :reference_of
|
|
|
|
has_many :subscriptions
|
|
has_many :subscribers, :through => :subscriptions
|
|
end
|