Reputation: 89
I got this error after trying to insert a simple if
condition in my controller :
def index
if params[:query].present?
@blog_posts = BlogPost.search(params[:query])
else
@blog_posts = BlogPost.all
end
end
Upvotes: 1
Views: 726
Reputation: 14419
Depends on how your model is setup. As the Tire README says, Mongoid is kinda funky with their IDs, you may have to define the to_indexed_json
yourself:
def to_indexed_json
self.as_json
end
Upvotes: 1