voteable_rickpeyton 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_rickpeyton.rb +19 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f634028a80f2aa780f97eca6a19f782aa30c872b
|
4
|
+
data.tar.gz: dfcf404177e3689f6122333ab68ffbab019ecb6b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98403395251f9e712c35180b6e1fc7406f0cfeaaac083a942318a77a978927c385718e0b859c3d1f335f5baf0ad28e11fd7401266f0c1ebafcf18ef513a3281a
|
7
|
+
data.tar.gz: bb8ee7f5fd0c7e4e7c8b45bfbc1ff8a2597d9cbd9d8e9ac32f3e04859eb959be73358ebbb76dc35df9868162bbf4e810ef9b54d45c3b8bf8e2e82ac7d1b9f84a
|
@@ -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 vote_count
|
9
|
+
positive_votes - negative_votes
|
10
|
+
end
|
11
|
+
|
12
|
+
def positive_votes
|
13
|
+
self.votes.where(vote: true).count
|
14
|
+
end
|
15
|
+
|
16
|
+
def negative_votes
|
17
|
+
self.votes.where(vote: false).count
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voteable_rickpeyton
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rick Peyton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Vote up and Vote down module for Tealeaf Academy Projects
|
14
|
+
email: peytorb@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/voteable_rickpeyton.rb
|
20
|
+
homepage: http://rubygems.org/gems/voteable_rickpeyton
|
21
|
+
licenses:
|
22
|
+
- ''
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.5
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Vote up and Vote down module for Tealeaf Academy Projects
|
44
|
+
test_files: []
|