ruby - Undefined method bson_type for model in Rails and MongoId -


i'm having issues mongoid when adding elements embeds_many relation: undefined method bson_type #<discount:0x007f3c599747e8> in advance.

here code:

class discount   include mongoid::document   embedded_in :discountable, polymorphic: true end  class user   include mongoid::document    embeds_many :discounts, as: :discountable   field :client_ids, type: array end  class userscontroller < applicationcontroller   def review     ...     current_user.push discounts: like_discount     current_user.push client_ids: params[:client_id]     ...   end end 

i have tried approach without success; (works embeds_many not normal array).

class userscontroller < applicationcontroller   def review     ...     current_user.discounts.push like_discount     current_user.client_ids.push params[:client_id]     ...   end end 


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -