ckb-voteable 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ckb-voteable.rb +19 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 922e735a80878862f4b5404ba430ed0952306e40
|
4
|
+
data.tar.gz: b0ac2604939400f35d232f5190656a58211e16aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b14f0befdeacc5cc088b6920b3d270431dbd7dd1b372759cd4631d5862933357f7458854c0e20dc2ce312cff011db5ae0f192dbd88b965259c54eea1aa0b0d38
|
7
|
+
data.tar.gz: 413d87ae4bca9fc2b75cc882701980067848b7b5ff68b1a1abcc1125213808d0fe9839356b67b7b077c137abc79867dd69205d02f081857bc0729b0f47f6005b
|
data/lib/ckb-voteable.rb
ADDED
@@ -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
|
+
up_votes - down_votes
|
10
|
+
end
|
11
|
+
|
12
|
+
def up_votes
|
13
|
+
votes.where(value: true).size
|
14
|
+
end
|
15
|
+
|
16
|
+
def down_votes
|
17
|
+
votes.where(value: false).size
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ckb-voteable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Conrad Beach
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 'Experimental: This gem allows you to add voting functionality to a model
|
14
|
+
in Rails.'
|
15
|
+
email: conradbeach@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/ckb-voteable.rb
|
21
|
+
homepage: http://conradcodes.com
|
22
|
+
licenses:
|
23
|
+
- MIT
|
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.5.2
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Add voting to models in Rails.
|
45
|
+
test_files: []
|
46
|
+
has_rdoc:
|