up: using config to build ar relations

main
Washington Botelho 2018-02-09 16:53:00 -02:00
parent 148f12f8f9
commit e9e08564e7
No known key found for this signature in database
GPG Key ID: 5DE4F42A8F073617
1 changed files with 3 additions and 3 deletions

View File

@ -48,17 +48,17 @@ module Rating
has_many :rating_records, has_many :rating_records,
as: :resource, as: :resource,
class_name: '::Rating::Rating', class_name: ::Rating.config.rating_model,
dependent: :destroy dependent: :destroy
has_many :rates_records, has_many :rates_records,
as: :resource, as: :resource,
class_name: '::Rating::Rate', class_name: ::Rating.config.rate_model,
dependent: :destroy dependent: :destroy
has_many :rated_records, has_many :rated_records,
as: :author, as: :author,
class_name: '::Rating::Rate', class_name: ::Rating.config.rate_model,
dependent: :destroy dependent: :destroy
scope :order_by_rating, ->(column = :estimate, direction = :desc, scope: nil) { scope :order_by_rating, ->(column = :estimate, direction = :desc, scope: nil) {