up: using config to build ar relations
parent
148f12f8f9
commit
e9e08564e7
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue