voteable_aimee 0.0.0
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.
- checksums.yaml +7 -0
- data/lib/voteable_aimee.rb +19 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 86fe0dd58caa7571a754610a3d1c1a8ce230a8ed
|
|
4
|
+
data.tar.gz: 841d1345b407a1ff01bf3a33f5888fd9e258a7e2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 107e6c5c9294a96c49f79ef903230438b97c704bb4ec35f426962b3018e3462ed66bff3dd459203327838658ea89387480f748d4447bfa204b4136814154e66e
|
|
7
|
+
data.tar.gz: 06682e4a4c488840836e66c874735189f820137bf7b0bb629aec780f05fc8d3c6319940f5a722f90fb158242a81f7657bf3b5e3cfe06253e7b6e3fc0829035f1
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Voteable
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
has_many :votes, as: :voteable
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def number_of_up_votes
|
|
9
|
+
self.votes.where(vote: true).size
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def number_of_down_votes
|
|
13
|
+
self.votes.where(vote: false).size
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def number_of_votes
|
|
17
|
+
number_of_up_votes - number_of_down_votes
|
|
18
|
+
end
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voteable_aimee
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Aimee
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-11-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Mixable module designed to allow for polymorphic voting by including
|
|
14
|
+
on any other model which can be voted on. Provides the polymorphic association,
|
|
15
|
+
and methods to calculate up, down and total votes.
|
|
16
|
+
email:
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/voteable_aimee.rb
|
|
22
|
+
homepage:
|
|
23
|
+
licenses: []
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubyforge_project:
|
|
41
|
+
rubygems_version: 2.4.4
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: module for polymorphic voting
|
|
45
|
+
test_files: []
|