proton/mongoid_rateable — Issue #4: rated_by doesn't work for embedded rateables
Author: Tuxie
Created: 2011-11-07 15:30:36+00:00
State: open

```ruby
class Foo
include Mongoid::Document
embeds_many :bars
end
class Bar
include Mongoid::Document
include Mongoid::Rateable
embedded_in :foo
end
class User
include Mongoid::Document
end

user = User.create
foo = Foo.create
bar = foo.bars.create
bar.rate(5, user)
Bar.rated_by(user).to_a
```
```
Mongoid::Errors::InvalidCollection: Access to the collection for Bar is not allowed since it is an embedded document, please access a collection from the root document.
```

Is there a solution for this or do I have to refactor?