nagybence-vote_fu 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,11 @@
1
+ 2008-12-02
2
+ ==========
3
+ * Merge in maddox's README typo fix and his ActiveSupport.Dependency patch
4
+ * Merge in nagybence's updates that make the code usable as a Gem in addition to being a Rails plugin.
5
+ * Thanks for the bugfixes and proofreading, nagybence and maddox!
6
+ * Updated the gemplugin support to be compatible with maddox and nagybence's changes.
7
+ * Added details on the MyQuotable reference application.
8
+
1
9
  2008-07-20
2
10
  ==========
3
11
  * Protect against mass assignment misvotes using attr\_accessible
data/README.markdown CHANGED
@@ -29,8 +29,7 @@ Run the following command:
29
29
 
30
30
  Create a new rails migration using the generator:
31
31
 
32
- ./script/generate voteable
33
-
32
+ ./script/generate voteable VoteableModel
34
33
 
35
34
  Usage
36
35
  =====
@@ -158,16 +157,36 @@ And if you want that enforced at the database level, look in the generated migra
158
157
  # If you want to enfore "One Person, One Vote" rules in the database, uncomment the index below
159
158
  # add_index :votes, ["voter_id", "voter_type", "voteable_id", "voteable_type"], :unique => true, :name => "uniq_one_vote_only"
160
159
 
160
+ ### Example Application
161
+
162
+ There is now a reference application available. Due to overwhelming demand for example
163
+ code and kickstart guides, I have open-sourced MyQuotable.com in order to provide an
164
+ easy-to-follow example of how to use VoteFu with RESTful Authentication, JRails, and
165
+ other popular plugins. To get the example code:
166
+
167
+ git clone git://github.com/peteonrails/myquotable.git
168
+
169
+ There will be a screencast coming soon too. Contact me if you want to help.
161
170
 
162
171
  Consideration
163
172
  =============
164
173
  If you like this software and use it, please consider recommending me on Working With Rails.
174
+
165
175
  I don't want donations: a simple up-vote would make my day. My profile is: [http://www.workingwithrails.com/person/12521-peter-jackson][4]
176
+
166
177
  To go directly to the "Recommend Me" screen: [http://www.workingwithrails.com/recommendation/new/person/12521-peter-jackson][5]
167
178
 
168
179
 
169
180
  Credits
170
- _______
181
+ =======
182
+
183
+ #### Contributors
184
+
185
+ * Bence Nagy, Budapest, Hungary
186
+ * Jon Maddox, Richmond, Virginia, USA
187
+
188
+ #### Other works
189
+
171
190
  [Juixe - The original ActsAsVoteable plugin inspired this code.][1]
172
191
 
173
192
  [Xelipe - This plugin is heavily influenced by Acts As Commentable.][2]
@@ -176,12 +195,16 @@ _______
176
195
  [2]: http://github.com/jackdempsey/acts_as_commentable/tree/master
177
196
 
178
197
  More
179
- ____
198
+ ====
199
+
200
+ Support: [Use my blog for support.][6]
201
+
180
202
 
181
203
  [Documentation from the original acts\_as\_voteable plugin][3]
182
204
 
183
205
  [3]: http://www.juixe.com/techknow/index.php/2006/06/24/acts-as-voteable-rails-plugin/
184
206
  [4]: http://www.workingwithrails.com/person/12521-peter-jackson
185
207
  [5]: http://www.workingwithrails.com/recommendation/new/person/12521-peter-jackson
208
+ [6]: http://blog.peteonrails.com
186
209
 
187
210
  Copyright (c) 2008 Peter Jackson, released under the MIT license
@@ -94,7 +94,7 @@ module Juixe
94
94
  self.votes.each { |v|
95
95
  voters << v.voter
96
96
  }
97
- users
97
+ voters
98
98
  end
99
99
 
100
100
  def voted_by?(voter)
data/lib/acts_as_voter.rb CHANGED
@@ -65,9 +65,7 @@ module PeteOnRails
65
65
  end
66
66
 
67
67
  def vote(voteable, vote)
68
- vote = Vote.new(:vote => vote)
69
- voteable.votes << vote
70
- self.votes << vote
68
+ vote = Vote.new(:vote => vote, :voteable => voteable, :voter => self)
71
69
  vote.save
72
70
  end
73
71
 
data/lib/models/vote.rb CHANGED
@@ -9,7 +9,7 @@ class Vote < ActiveRecord::Base
9
9
  belongs_to :voteable, :polymorphic => true
10
10
  belongs_to :voter, :polymorphic => true
11
11
 
12
- attr_accessible :vote
12
+ attr_accessible :vote, :voter, :voteable
13
13
 
14
14
  # Uncomment this to limit users to a single vote on each item.
15
15
  # validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id]
data/rails/init.rb ADDED
@@ -0,0 +1,10 @@
1
+ RAILS_DEFAULT_LOGGER.info "** vote_fu: setting up load paths"
2
+
3
+ %w{ models controllers helpers }.each do |dir|
4
+ path = File.join(File.dirname(__FILE__) , 'lib', dir)
5
+ $LOAD_PATH << path
6
+ ActiveSupport::Dependencies.load_paths << path
7
+ ActiveSupport::Dependencies.load_once_paths.delete(path)
8
+ end
9
+
10
+ require 'vote_fu'
@@ -1,6 +1,6 @@
1
1
  require 'test/unit'
2
2
 
3
- class ActsAsVoteableTest < Test::Unit::TestCase
3
+ class VoteFuTest < Test::Unit::TestCase
4
4
  # Replace this with your real tests.
5
5
  def test_this_plugin
6
6
  flunk
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagybence-vote_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Jackson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-11-17 00:00:00 -08:00
13
+ date: 2008-12-02 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -37,7 +37,7 @@ files:
37
37
  - lib/has_karma.rb
38
38
  - lib/models/vote.rb
39
39
  - lib/controllers/votes_controller.rb
40
- - test/voteable_test.rb
40
+ - test/vote_fu_test.rb
41
41
  - examples/votes_controller.rb
42
42
  - examples/users_controller.rb
43
43
  - examples/voteables_controller.rb
@@ -46,6 +46,7 @@ files:
46
46
  - examples/votes/_voteable_vote.html.erb
47
47
  - examples/votes/create.rjs
48
48
  - examples/routes.rb
49
+ - rails/init.rb
49
50
  has_rdoc: false
50
51
  homepage: http://blog.peteonrails.com/vote-fu
51
52
  post_install_message: