voteable_gus 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/voteable_gus.rb +13 -0
  3. metadata +43 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 722a7fc518b91086fe5472113da18b22998d97e2
4
+ data.tar.gz: 84ab4c1aa726de7476d377c6903d80dd585e1b31
5
+ SHA512:
6
+ metadata.gz: 3723b995dfada05e89ebdfadcab4dda61952a22b548d2a7987d459418414a392daf36cd2f7632f4789f5c1c4aa24ac39254adee61a6ff283eb6f435c4044d8b4
7
+ data.tar.gz: 1a3da2b99dc82ab1c732d25d98b2273fd185c45863b0adc48f447d68c3eeadccc14284812f00c8f004df8cfb9cafd3afdb9e7035c91a7d1bc697d146eb1c50ac
@@ -0,0 +1,13 @@
1
+ module Voteable
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ has_many :votes, as: :voteable
7
+ end
8
+
9
+ def total_votes
10
+ self.votes.where(vote: true).count - self.votes.where(vote: false).count
11
+ end
12
+
13
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voteable_gus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Gustavo Caso
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Testing first gem
14
+ email: gustavocaso@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/voteable_gus.rb
20
+ homepage: http://github.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.2
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Voting Gem
43
+ test_files: []