Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ryanto/acts_as_votable
base: master
...
head fork: supherman/acts_as_votable
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
2  lib/acts_as_votable/votable.rb
@@ -81,7 +81,7 @@ def vote args = {}
_votes_ = find_votes({
:voter_id => options[:voter].id,
:vote_scope => options[:vote_scope],
- :voter_type => options[:voter].class.name
+ :voter_type => options[:voter].class.base_class.name
})
if _votes_.count == 0
View
4 spec/spec_helper.rb
@@ -64,6 +64,10 @@ class NotVoter < ActiveRecord::Base
end
+class StiVoter < Voter
+
+end
+
class Votable < ActiveRecord::Base
acts_as_votable
validates_presence_of :name
View
17 spec/votable_spec.rb
@@ -285,6 +285,23 @@
end
+ describe 'STI voter' do
+ before(:each) do
+ clean_database
+ @voter = StiVoter.create(:name => 'i can vote!')
+ end
+
+ it "should be able to vote only once" do
+ votable = ChildOfStiVotable.create(:name => 'sti child')
+
+ votable.vote :voter => @voter, :vote => 'yes'
+ votable.vote :voter => @voter, :vote => 'yes'
+ votable.votes.size.should == 1
+ end
+
+
+ end
+
end

No commit comments for this range

Something went wrong with that request. Please try again.