activerecord-tableless
activerecord-tableless copied to clipboard
Rails 3.2.13 problems with has_many_through relationships
In Rails 3.2.13 I'm experiencing problems when trying to use tableless models as one side of a has_many_through relationship
class List < ActiveRecord::Base
# persisted model
has_many :memberships
has_many :items , :through => :memberships
...
end
class Item < ActiveRecord::Base
has_no_table :database => :pretend_success
has_many :memberships
has_many :lists , :through => :memberships
...
end
class Mermbership < ActiveRecord::Base
# persisted model / join model
belongs_to :list
belongs_to :item
end
l = List.first
l.items
(Object doesn't support #inspect)
l.items.class
NoMethodError: undefined method 'supports_explain?' for #<Object:...>
the faked connection needs to fake the select_all, select_value, select_values calls
Thanks for investigating, can you provide a pull request...