voteable_ryang 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/voteable_ryang.rb +19 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b3317df3976d26ec2005886cd8b60eb550686926
|
4
|
+
data.tar.gz: 2e2dccbee16b59a1743a4c80c59969ddddea3240
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7bac252aea9296ee4cc0e5f10158d6fc3cafca480ddf323c9985f1e341c84812fd1148ad20de28714cca6615fa0beb7bf32277fdf37ccc4a4e8010f9b0722082
|
7
|
+
data.tar.gz: 4781d7594be7663106e15da477fe44fa0f38f61701fe3a711ff5441ad9d64ddaf6a5f79fb0461d231d85929624da67cbec04ec03b6eb971259f5173ea5fd0909
|
@@ -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 total_votes
|
9
|
+
self.up_votes - self.down_votes
|
10
|
+
end
|
11
|
+
|
12
|
+
def up_votes
|
13
|
+
self.votes.where(vote: true).count
|
14
|
+
end
|
15
|
+
|
16
|
+
def down_votes
|
17
|
+
self.votes.where(vote: false).count
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voteable_ryang
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan George
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Use this gem to add voting to your Rails models.
|
14
|
+
email: ryan.geo@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/voteable_ryang.rb
|
20
|
+
homepage: http://github.com/audiac
|
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.4.6
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: A voting gem
|
43
|
+
test_files: []
|