vendredi 24 avril 2020

'joins' queries are not working on upgrading ruby from 2.0.0 to 2.3.8

I have just updated the ruby version of my project from ruby-2.0.0 to ruby-2.3.8. Now after update there seems to be a problem while using joins in rails and I am not getting why. Here is the code below.

class User < ActiveRecord::Base
has_many :items
end

class Item < ActiveRecord::Base
belongs_to :user
has_many :donors, :as => :itemable, :dependent => :destroy
end

u = User.find_by_id(15)
u.items.joins(:donors)

it is returning me a Module object like '#<#Module<:0x00000000088932f0>:0x44497e8>', which is inaccessible

but the same thing when I do in my previous ruby version before updating

it gave me the ActiveRecord:: Relation object as expected

I am not getting the problem so if anybody can suggest something.

Aucun commentaire:

Enregistrer un commentaire