acts_rateable 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,10 +8,10 @@ module ActsRateable
8
8
 
9
9
  def acts_rateable(options = {})
10
10
 
11
- has_many :rates, class_name: ActsRateable::Rate, as: :resource, dependent: :destroy
12
- has_many :rated, class_name: ActsRateable::Rate, as: :author, dependent: :destroy
13
- has_one :rating, class_name: ActsRateable::Rating, as: :resource, dependent: :destroy
14
- has_one :count, class_name: ActsRateable::Count, as: :resource, dependent: :destroy
11
+ has_many :rates, class_name: ActsRateable::Rate, foreign_key: :resource_id, conditions: { resource_type: self.name }, dependent: :destroy
12
+ has_many :rated, class_name: ActsRateable::Rate, foreign_key: :author_id, conditions: { author_type: self.name }, dependent: :destroy
13
+ has_one :rating, class_name: ActsRateable::Rating, foreign_key: :resource_id, conditions: { resource_type: self.name }, dependent: :destroy
14
+ has_one :count, class_name: ActsRateable::Count, foreign_key: :resource_id, conditions: { resource_type: self.name }, dependent: :destroy
15
15
 
16
16
  scope :order_by_rating, lambda { | column='estimate', direction="DESC" |
17
17
  includes(:rating).group('ar_ratings.id').order("ar_ratings.#{column.downcase} #{direction.upcase}")
@@ -1,3 +1,3 @@
1
1
  module ActsRateable
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_rateable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-02 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails