voteable_clint 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/voteable_clint.rb +18 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6dc654f64f38f4866be2e7958492820ca13b7d0
|
4
|
+
data.tar.gz: b1ed4bdb74897224c8c6b534c9a1bdd136f05313
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cd27a9c622b4d1cb4c3e5184c2eb2ab0b2771fd8cd391fa2338324b1be411df712cd930aa355846abc7897be93bd818f99a0c9281040a1fef011c28ef6987826
|
7
|
+
data.tar.gz: 0b9cbbc8664142422613366a5e0f83be80e0cf49ece5efa53abfc3566d3d6b063ce61e0f4ca875035da1ab2581ac73c7cb059f16b1a2f4e391dbb0d5899f7c5b
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Voteable
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
has_many :votes, as: :voteable
|
5
|
+
end
|
6
|
+
|
7
|
+
def total_votes
|
8
|
+
self.up_votes - self.down_votes
|
9
|
+
end
|
10
|
+
|
11
|
+
def up_votes
|
12
|
+
self.votes.where(vote: true).size
|
13
|
+
end
|
14
|
+
|
15
|
+
def down_votes
|
16
|
+
self.votes.where(vote: false).size
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voteable_clint
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Clint Wiley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple voting gem
|
14
|
+
email: cwiley@nfis.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/voteable_clint.rb
|
20
|
+
homepage: http://www.nfis.com
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.2.0
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: A voting gem
|
43
|
+
test_files: []
|