-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I have some troubles with cancan and mongoid
(sorry, I am a Newbie)
<pre><code>undefined method `reflect_on_association' for "4ff484be34257be50d00000a":String</code></pre>
My Model (self referencing):
<pre><code>
class Musicstyle
include Mongoid::Document
field :title, type: String
field :description, type: String
recursively_embeds_many
validates_presence_of :title
validates_uniqueness_of :title
end
</pre></code>
Controller:
<pre><code>load_and_authorize_resource
def create
if params[:musicstyle][:parent_musicstyle] = nil
parent = Musicstyle.find(params[:musicstyle].delete(:parent_musicstyle))
parent.child_musicstyles.create(params[:musicstyle])
end
@musicstyle = Musicstyle.new(params[:musicstyle])
end
end
</code></pre>
I found out, that when I remove the <code>load_and_authorize_resource</code> function from the controller -> all worked perfectly
I am not sure I am done something wrong or cancan or mongoid raises this issue....
Any help will be appriciate
I am using mongoid (2.4.10) and cancan (1.6.7)