Acts_as_rated error

I’m trying to use acts_as_rated and getting this error:

Mysql::Error: #42S22Unknown column ‘ratings.post_id’ in ‘where
clause’: SELECT * FROM ratings WHERE (ratings.post_id = 14 AND
(rater_id = 2)) LIMIT 1

not sure why it’s looking for a post_id column. shouldn’t it be
looking for rated_id ?

here’s my model being rated

class Post < ActiveRecord::Base
acts_as_rated :rater_class => ‘Inker’, :rating_range => 0…5
has_many :ratings
has_one :rating_statistic

“Inker” is my “User” model

I think I did the migration correctly b/c my schema has the necessary
tables and columns

create_table “posts”, :force => true do |t|

t.column “rating_count”, :integer
t.column “rating_total”, :integer, :limit => 10, :precision
=> 10, :scale => 0
t.column “rating_avg”, :decimal, :precision
=> 10, :scale => 2
end

create_table “rating_statistics”, :force => true do |t|
t.column “rated_id”, :integer
t.column “rated_type”, :string
t.column “rating_count”, :integer
t.column “rating_total”, :integer, :limit => 10, :precision =>
10, :scale => 0
t.column “rating_avg”, :decimal, :precision =>
10, :scale => 2
end

add_index “rating_statistics”, [“rated_type”, “rated_id”], :name =>
“index_rating_statistics_on_rated_type_and_rated_id”

create_table “ratings”, :force => true do |t|
t.column “rater_id”, :integer
t.column “rated_id”, :integer
t.column “rated_type”, :string
t.column “rating”, :integer, :limit => 10, :precision =>
10, :scale => 0
end

add_index “ratings”, [“rater_id”], :name =>
“index_ratings_on_rater_id”
add_index “ratings”, [“rated_type”, “rated_id”], :name =>
“index_ratings_on_rated_type_and_rated_id”

any help is appreciated

I figured out the problem, It’s this:

class Post < ActiveRecord::Base
acts_as_rated:rater_class => ‘Inker’, :rating_range => 0…5
has_many :ratings
has_one :rating_statistic

I got confused by the doc. I’m not supposed to add the associations,
the plugin does it for me (and does it correctly).

I found a curious problem and I don’t know if it’s a problem with the
plugin or I’m doing something wrong, but all my rating avg are rounded
to nearest integer. I changed the rating_total from decimal(10,0) to
decimal(10,1). Although it’s always going to be .0 (I don’t allow
fractional ratings), this makes the avg calculation correct. I’m
using mysql.