Displaying 2 results from an estimated 2 matches for "voter_id".
Did you mean:
note_id
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
...y other thing to do to it?
The code is this one
class Item < ActiveRecord::Base
has_many :votes, :as => :voteable
def self.ranking(user_id)
Item.find(:all,
# items.* for all the Item attributes, score being the sum of votes,
user_vote is the vote of user_id (0 if no vote) and voter_id is just user_id
for latter reference.
:select => "items.*,
IFNULL(sum(all_votes.value), 0) as score,
user_votes.value as user_vote,
\"#{user_id}\" as voter_id",
# The first join gets all the votes for a single...
2005 Feb 02
1
Error when changing from AR 1.0.1 to 1.6
...tive_record/associations.rb:218:in `has_many_without_reflection''\r
[error] \tfrom (eval):5:in `has_many''\r
[error] \tfrom C:/dev/granul.at/app/models/user.rb:7\r
the user.rb looks as follows:
class User < ActiveRecord::Base
has_many :post_votes, :foreign_key => ''voter_id''
has_many :topic_subscriptions, :dependent => true
has_many :posts
has_many :topic_reads, :dependent => true
def self.inheritance_column() ''role'' end
include ErrorRaising, RForum::Localization, ActiveRecord::Mixins::Touch
attr_accessor :old_password, :...