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