Commit 59d5b8f6f400f96988ea2d9c1769ad9a0ef0b7ce
1 parent
2f21005a
Exists in
master
and in
22 other branches
rails3: adjust vote_fu to rails3
Showing
3 changed files
with
6 additions
and
6 deletions
Show diff stats
vendor/plugins/vote_fu/examples/voteable.rb
| @@ -4,7 +4,7 @@ class Voteable < ActiveRecord::Base | @@ -4,7 +4,7 @@ class Voteable < ActiveRecord::Base | ||
| 4 | 4 | ||
| 5 | acts_as_voteable | 5 | acts_as_voteable |
| 6 | 6 | ||
| 7 | - named_scope :descending, :order => "created_at DESC" | 7 | + scope :descending, :order => "created_at DESC" |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | end | 10 | end |
| 11 | \ No newline at end of file | 11 | \ No newline at end of file |
vendor/plugins/vote_fu/lib/models/vote.rb
| 1 | class Vote < ActiveRecord::Base | 1 | class Vote < ActiveRecord::Base |
| 2 | 2 | ||
| 3 | - named_scope :for_voter, lambda { |*args| {:conditions => ["voter_id = ? AND voter_type = ?", args.first.id, args.first.class.base_class.name]} } | ||
| 4 | - named_scope :for_voteable, lambda { |*args| {:conditions => ["voteable_id = ? AND voteable_type = ?", args.first.id, args.first.class.base_class.name]} } | ||
| 5 | - named_scope :recent, lambda { |*args| {:conditions => ["created_at > ?", (args.first || 2.weeks.ago).to_s(:db)]} } | ||
| 6 | - named_scope :descending, :order => "created_at DESC" | 3 | + scope :for_voter, lambda { |*args| {:conditions => ["voter_id = ? AND voter_type = ?", args.first.id, args.first.class.base_class.name]} } |
| 4 | + scope :for_voteable, lambda { |*args| {:conditions => ["voteable_id = ? AND voteable_type = ?", args.first.id, args.first.class.base_class.name]} } | ||
| 5 | + scope :recent, lambda { |*args| {:conditions => ["created_at > ?", (args.first || 2.weeks.ago).to_s(:db)]} } | ||
| 6 | + scope :descending, :order => "created_at DESC" | ||
| 7 | 7 | ||
| 8 | # NOTE: Votes belong to the "voteable" interface, and also to voters | 8 | # NOTE: Votes belong to the "voteable" interface, and also to voters |
| 9 | belongs_to :voteable, :polymorphic => true | 9 | belongs_to :voteable, :polymorphic => true |
vendor/plugins/vote_fu/lib/vote_fu.rb
| @@ -6,4 +6,4 @@ require 'models/vote.rb' | @@ -6,4 +6,4 @@ require 'models/vote.rb' | ||
| 6 | ActiveRecord::Base.send(:include, Juixe::Acts::Voteable) | 6 | ActiveRecord::Base.send(:include, Juixe::Acts::Voteable) |
| 7 | ActiveRecord::Base.send(:include, PeteOnRails::Acts::Voter) | 7 | ActiveRecord::Base.send(:include, PeteOnRails::Acts::Voter) |
| 8 | ActiveRecord::Base.send(:include, PeteOnRails::VoteFu::Karma) | 8 | ActiveRecord::Base.send(:include, PeteOnRails::VoteFu::Karma) |
| 9 | -RAILS_DEFAULT_LOGGER.info "** vote_fu: initialized properly." | 9 | +Rails.logger.info "** vote_fu: initialized properly." |