theoooo-tally 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/models/tally_sheet.rb +21 -0
- metadata +3 -4
- data/Rakefile +0 -56
- data/VERSION.yml +0 -4
@@ -0,0 +1,21 @@
|
|
1
|
+
class TallySheet < ActiveRecord::Base
|
2
|
+
|
3
|
+
belongs_to :voter, :polymorphic => true
|
4
|
+
belongs_to :tallyable, :polymorphic => true, :counter_cache => true
|
5
|
+
|
6
|
+
validates_uniqueness_of :tallyable_id, :scope => [:tallyable_type, :voter_type, :voter_id]
|
7
|
+
validates_inclusion_of :for, :in => [true, false]
|
8
|
+
|
9
|
+
attr_protected :voter, :tallyable
|
10
|
+
|
11
|
+
# TODO: Figure out why i can't just reference :tallyable => tallyable
|
12
|
+
named_scope :tally, lambda { |tallyable|
|
13
|
+
{ :conditions => { :tallyable_id => tallyable.id, :tallyable_type => tallyable.class.to_s } }
|
14
|
+
}
|
15
|
+
|
16
|
+
# TODO: Figure out why i can't just reference :tallyable => tallyable
|
17
|
+
named_scope :voter, lambda { |voter|
|
18
|
+
{ :conditions => { :voter_id => voter.id, :voter_type => voter.class.to_s } }
|
19
|
+
}
|
20
|
+
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theoooo-tally
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Cushion
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -25,8 +25,7 @@ extra_rdoc_files:
|
|
25
25
|
files:
|
26
26
|
- LICENSE
|
27
27
|
- README.rdoc
|
28
|
-
-
|
29
|
-
- VERSION.yml
|
28
|
+
- app/models/tally_sheet.rb
|
30
29
|
- generators/tally/tally_generator.rb
|
31
30
|
- generators/tally/templates/tally_migration.rb.erb
|
32
31
|
- lib/tally.rb
|
data/Rakefile
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "tally"
|
8
|
-
gem.summary = %Q{TODO}
|
9
|
-
gem.email = "theo@jivatechnology.com"
|
10
|
-
gem.homepage = "http://github.com/theoooo/tally"
|
11
|
-
gem.authors = ["Theo Cushion"]
|
12
|
-
|
13
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
-
end
|
15
|
-
rescue LoadError
|
16
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
17
|
-
end
|
18
|
-
|
19
|
-
require 'rake/testtask'
|
20
|
-
Rake::TestTask.new(:test) do |test|
|
21
|
-
test.libs << 'lib' << 'test'
|
22
|
-
test.pattern = 'test/**/*_test.rb'
|
23
|
-
test.verbose = true
|
24
|
-
end
|
25
|
-
|
26
|
-
begin
|
27
|
-
require 'rcov/rcovtask'
|
28
|
-
Rcov::RcovTask.new do |test|
|
29
|
-
test.libs << 'test'
|
30
|
-
test.pattern = 'test/**/*_test.rb'
|
31
|
-
test.verbose = true
|
32
|
-
end
|
33
|
-
rescue LoadError
|
34
|
-
task :rcov do
|
35
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
task :default => :test
|
41
|
-
|
42
|
-
require 'rake/rdoctask'
|
43
|
-
Rake::RDocTask.new do |rdoc|
|
44
|
-
if File.exist?('VERSION.yml')
|
45
|
-
config = YAML.load(File.read('VERSION.yml'))
|
46
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
|
-
else
|
48
|
-
version = ""
|
49
|
-
end
|
50
|
-
|
51
|
-
rdoc.rdoc_dir = 'rdoc'
|
52
|
-
rdoc.title = "tally #{version}"
|
53
|
-
rdoc.rdoc_files.include('README*')
|
54
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
-
end
|
56
|
-
|
data/VERSION.yml
DELETED