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 +8 -0
- data/README.markdown +27 -4
- data/lib/acts_as_voteable.rb +1 -1
- data/lib/acts_as_voter.rb +1 -3
- data/lib/models/vote.rb +1 -1
- data/rails/init.rb +10 -0
- data/test/{voteable_test.rb → vote_fu_test.rb} +1 -1
- metadata +4 -3
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
|
data/lib/acts_as_voteable.rb
CHANGED
data/lib/acts_as_voter.rb
CHANGED
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'
|
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.
|
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-
|
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/
|
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:
|