FactValue.joins(:host => :content_facet).to_sql
ActiveRecord::ConfigurationError: Can’t join ‘Host::Base’ to association named ‘content_facet’; perhaps you misspelled it?
“”"
Let me know how I can join Host and Content Facet or any facets for that matter to FactValue so that I dont have to do this join.
console > Report.joins(:host => [:content_facet]).to_sql
=> “SELECT "reports".* FROM "reports" INNER JOIN "hosts" ON "hosts"."id" = "reports"."host_id" AND "hosts"."type" IN (‘Host::Managed’) AND "hosts"."organization_id" = 1 AND "hosts"."location_id" = 2 INNER JOIN "katello_content_facets" ON "katello_content_facets"."host_id" = "hosts"."id"”
While
console > FactValue.joins(:host => [:content_facet]).to_sql
=> ActiveRecord::ConfigurationError: Can’t join ‘Host::Base’ to association named ‘content_facet’; perhaps you misspelled it?
from /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.6/lib/active_record/associations/join_dependency.rb:233:in `find_reflection’
I am not sure what is special in Reports (which is not in base but is in managed only). More over the host joins content)facets works fine from Reports but not from FactValue.
Without looking at the models, I would check definition of :hosts on both models. My guess would be connection to Host::Base in facts and Host::Managed in reports.
Anyway question is can we just move facets stuff from Host::Managed to Host::Base ? That would probably be a lower risk and more straight forward change than the perms change we have right now.
Short answer: It should be possible.
TLDR: I remember finding some methods that are defined only on Host::Managed, so I will need to try and do it in order to say something definitive. Key file would be app/models/concerns/facets/managed_host_extensions.rb.