active_record-acts_as: has_one with sub class does not work

Given these models:

class Photo < ActiveRecord::Base
  actable
  belongs_to :user
end

class Avatar < ActiveRecord::Base
  acts_as :photo
end

class User < ActiveRecord::Base
  has_one :avatar
  has_many :photos
end

When I call user.avatar it raises an error like this:

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR:  column avatars.user_id does not exist

It seems that we haven’t supported this feature yet. Is there anyway we can work around this? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

This problem is probably fixed in v2.0.3 which was just released. Please open another issue if it still happens with that version.