Project

General

Profile

Bug #23208

Validate existing FK relationships

Added by Andrew Kofink over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Use the association_exists_validator that was added in #21829. A quick grep shows the following list:

grep "belongs_to " -R app/models

app/models/katello/repository_deb.rb:    belongs_to :repository, :inverse_of => :repository_debs, :class_name => 'Katello::Repository'
app/models/katello/repository_deb.rb:    belongs_to :deb, :inverse_of => :repository_debs, :class_name => 'Katello::Deb'
app/models/katello/capsule_lifecycle_environment.rb:    belongs_to :capsule, :class_name => "::SmartProxy", :inverse_of => :capsule_lifecycle_environments
app/models/katello/capsule_lifecycle_environment.rb:    belongs_to :lifecycle_environment, :class_name => "Katello::KTEnvironment", :inverse_of => :capsule_lifecycle_environments
app/models/katello/concerns/container_extensions.rb:        belongs_to :capsule, :inverse_of => :containers, :foreign_key => :capsule_id,
app/models/katello/concerns/hostgroup_extensions.rb:        belongs_to :kickstart_repository, :class_name => "::Katello::Repository",
app/models/katello/concerns/hostgroup_extensions.rb:        belongs_to :content_source, :class_name => "::SmartProxy", :foreign_key => :content_source_id, :inverse_of => :hostgroups
app/models/katello/concerns/hostgroup_extensions.rb:        belongs_to :content_view, :inverse_of => :hostgroups, :class_name => "::Katello::ContentView" 
app/models/katello/concerns/hostgroup_extensions.rb:        belongs_to :lifecycle_environment, :inverse_of => :hostgroups, :class_name => "::Katello::KTEnvironment" 
app/models/katello/content_facet_applicable_rpm.rb:    belongs_to :content_facet, :inverse_of => :content_facet_applicable_rpms, :class_name => 'Katello::Host::ContentFacet'
app/models/katello/content_facet_applicable_rpm.rb:    belongs_to :rpm, :inverse_of => :content_facet_applicable_rpms, :class_name => 'Katello::Rpm'
app/models/katello/content_facet_erratum.rb:    belongs_to :content_facet, :inverse_of => :content_facet_errata, :class_name => 'Katello::Host::ContentFacet'
app/models/katello/content_facet_erratum.rb:    belongs_to :erratum, :inverse_of => :content_facet_errata, :class_name => 'Katello::Erratum'
app/models/katello/content_facet_repository.rb:    belongs_to :content_facet, :inverse_of => :content_facet_repositories, :class_name => 'Katello::Host::ContentFacet'
app/models/katello/content_facet_repository.rb:    belongs_to :repository, :inverse_of => :content_facet_repositories, :class_name => 'Katello::Repository'
app/models/katello/product_content.rb:    belongs_to :product, :class_name => 'Katello::Product', :foreign_key => 'product_id', :inverse_of => :product_contents
app/models/katello/product_content.rb:    belongs_to :content, :class_name => 'Katello::Content', :foreign_key => 'content_id', :inverse_of => :product_contents
app/models/katello/repository_srpm.rb:    belongs_to :repository, :inverse_of => :repository_srpms, :class_name => 'Katello::Repository'
app/models/katello/repository_srpm.rb:    belongs_to :srpm, :inverse_of => :repository_srpms, :class_name => 'Katello::Srpm'
app/models/katello/content_view_docker_filter_rule.rb:    belongs_to :filter,
app/models/katello/content_view_environment.rb:    belongs_to :content_view, :class_name => "Katello::ContentView", :inverse_of => :content_view_environments
app/models/katello/content_view_environment.rb:    belongs_to :environment, :class_name => "Katello::KTEnvironment", :inverse_of => :content_view_environments
app/models/katello/content_view_environment.rb:    belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion",
app/models/katello/content_view_version.rb:    belongs_to :content_view, :class_name => "Katello::ContentView", :inverse_of => :content_view_versions
app/models/katello/content_view_erratum_filter_rule.rb:    belongs_to :filter,
app/models/katello/content_view_filter.rb:    belongs_to :content_view,
app/models/katello/content_view_package_filter_rule.rb:    belongs_to :filter,
app/models/katello/content_view_package_group_filter_rule.rb:    belongs_to :filter,
app/models/katello/docker_meta_tag.rb:    belongs_to :repository, :inverse_of => :docker_meta_tags, :class_name => "Katello::Repository" 
app/models/katello/docker_meta_tag.rb:    belongs_to :schema1, :class_name => "Katello::DockerTag",
app/models/katello/docker_meta_tag.rb:    belongs_to :schema2, :class_name => "Katello::DockerTag",
app/models/katello/content_view_puppet_environment_puppet_module.rb:    belongs_to :content_view_puppet_environment,
app/models/katello/content_view_puppet_environment_puppet_module.rb:    belongs_to :puppet_module,
app/models/katello/content_view_puppet_module.rb:    belongs_to :content_view, :class_name => "Katello::ContentView", :inverse_of => :content_view_versions
app/models/katello/subscription.rb:    belongs_to :organization, :class_name => "Organization", :inverse_of => :subscriptions
app/models/katello/content_view_version_component.rb:    belongs_to :composite_version, :class_name => "Katello::ContentViewVersion", :inverse_of => :content_view_version_components
app/models/katello/content_view_version_component.rb:    belongs_to :component_version, :class_name => "Katello::ContentViewVersion", :inverse_of => :content_view_version_composites
app/models/katello/repository.rb:    belongs_to :environment, :inverse_of => :repositories, :class_name => "Katello::KTEnvironment" 
app/models/katello/repository.rb:    belongs_to :product, :inverse_of => :repositories
app/models/katello/repository.rb:    belongs_to :gpg_key, :inverse_of => :repositories
app/models/katello/repository.rb:    belongs_to :ssl_ca_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_ca_repos
app/models/katello/repository.rb:    belongs_to :ssl_client_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_client_repos
app/models/katello/repository.rb:    belongs_to :ssl_client_key, :class_name => "Katello::GpgKey", :inverse_of => :ssl_key_repos
app/models/katello/repository.rb:    belongs_to :library_instance, :class_name => "Katello::Repository", :inverse_of => :library_instances_inverse
app/models/katello/repository.rb:    belongs_to :content_view_version, :inverse_of => :repositories, :class_name => "Katello::ContentViewVersion" 
app/models/katello/content_view_history.rb:    belongs_to :environment, :class_name => "Katello::KTEnvironment", :inverse_of => :content_view_histories,
app/models/katello/content_view_history.rb:    belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion", :foreign_key => :katello_content_view_version_id, :inverse_of => :history
app/models/katello/content_view_history.rb:    belongs_to :triggered_by, :class_name => "Katello::ContentViewVersion", :inverse_of => :triggered_histories
app/models/katello/content_view_history.rb:    belongs_to :task, :class_name => "ForemanTasks::Task::DynflowTask", :foreign_key => :task_id
app/models/katello/content_view_repository.rb:    belongs_to :content_view, :inverse_of => :content_view_repositories,
app/models/katello/content_view_repository.rb:    belongs_to :repository, :inverse_of => :content_view_repositories,
app/models/katello/erratum_bugzilla.rb:    belongs_to :erratum, :inverse_of => :bugzillas, :class_name => 'Katello::Erratum'
app/models/katello/erratum_cve.rb:    belongs_to :erratum, :inverse_of => :cves, :class_name => 'Katello::Erratum'
app/models/katello/erratum_package.rb:    belongs_to :erratum, :inverse_of => :packages, :class_name => 'Katello::Erratum'
app/models/katello/host/content_facet.rb:      belongs_to :kickstart_repository, :class_name => "::Katello::Repository", :foreign_key => :kickstart_repository_id, :inverse_of => :kickstart_content_facets
app/models/katello/host/content_facet.rb:      belongs_to :content_view, :inverse_of => :content_facets, :class_name => "Katello::ContentView" 
app/models/katello/host/content_facet.rb:      belongs_to :lifecycle_environment, :inverse_of => :content_facets, :class_name => "Katello::KTEnvironment" 
app/models/katello/host/content_facet.rb:      belongs_to :content_source, :class_name => "::SmartProxy", :foreign_key => :content_source_id, :inverse_of => :content_facets
app/models/katello/host/subscription_facet.rb:      belongs_to :user, :inverse_of => :subscription_facets, :class_name => "::User" 
app/models/katello/host/subscription_facet.rb:      belongs_to :hypervisor_host, :class_name => "::Host::Managed", :foreign_key => "hypervisor_host_id" 
app/models/katello/host_collection.rb:    belongs_to :organization, :inverse_of => :host_collections
app/models/katello/host_collection_hosts.rb:    belongs_to :host, :inverse_of => :host_collection_hosts, :class_name => 'Host::Managed'
app/models/katello/host_collection_hosts.rb:    belongs_to :host_collection, :inverse_of => :host_collection_hosts
app/models/katello/host_tracer.rb:    belongs_to :host, :inverse_of => :host_traces, :class_name => '::Host::Managed'
app/models/katello/key_host_collection.rb:    belongs_to :activation_key, :inverse_of => :key_host_collections
app/models/katello/key_host_collection.rb:    belongs_to :host_collection, :inverse_of => :key_host_collections
app/models/katello/content_view_puppet_environment.rb:    belongs_to :environment, :class_name => "Katello::KTEnvironment",
app/models/katello/content_view_puppet_environment.rb:    belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion",
app/models/katello/content_view_puppet_environment.rb:    belongs_to :puppet_environment, :class_name => "Environment",
app/models/katello/pool_activation_key.rb:    belongs_to :pool, :inverse_of => :pool_activation_keys, :class_name => 'Katello::Pool'
app/models/katello/pool_activation_key.rb:    belongs_to :activation_key, :inverse_of => :pool_activation_keys, :class_name => 'Katello::ActivationKey'
app/models/katello/compliance_reason.rb:    belongs_to :subscription_facet, :inverse_of => :compliance_reasons, :class_name => 'Katello::Host::SubscriptionFacet'
app/models/katello/pool.rb:    belongs_to :subscription, :inverse_of => :pools, :class_name => "Katello::Subscription" 
app/models/katello/repository_docker_manifest.rb:    belongs_to :repository, :inverse_of => :repository_docker_manifests, :class_name => 'Katello::Repository'
app/models/katello/repository_docker_manifest.rb:    belongs_to :docker_manifest, :inverse_of => :repository_docker_manifests
app/models/katello/docker_tag.rb:    belongs_to :docker_taggable, :polymorphic => true, :inverse_of => :docker_tags
app/models/katello/docker_tag.rb:    belongs_to :repository, :inverse_of => :docker_tags, :class_name => "Katello::Repository" 
app/models/katello/repository_erratum.rb:    belongs_to :repository, :inverse_of => :repository_errata, :class_name => 'Katello::Repository'
app/models/katello/repository_erratum.rb:    belongs_to :erratum, :inverse_of => :repository_errata, :class_name => 'Katello::Erratum'
app/models/katello/repository_file.rb:    belongs_to :repository, :inverse_of => :repository_files, :class_name => 'Katello::Repository'
app/models/katello/repository_file.rb:    belongs_to :file, :inverse_of => :repository_files, :class_name => 'Katello::FileUnit', :foreign_key => :file_id
app/models/katello/repository_ostree_branch.rb:    belongs_to :repository, :inverse_of => :repository_ostree_branches, :class_name => 'Katello::Repository'
app/models/katello/repository_ostree_branch.rb:    belongs_to :ostree_branch, :inverse_of => :repository_ostree_branches
app/models/katello/repository_package_group.rb:    belongs_to :repository, :inverse_of => :repository_package_groups, :class_name => 'Katello::Repository'
app/models/katello/repository_package_group.rb:    belongs_to :package_group, :inverse_of => :repository_package_groups, :class_name => 'Katello::PackageGroup'
app/models/katello/repository_puppet_module.rb:    belongs_to :repository, :inverse_of => :repository_puppet_modules, :class_name => 'Katello::Repository'
app/models/katello/repository_puppet_module.rb:    belongs_to :puppet_module, :inverse_of => :repository_puppet_modules, :class_name => 'Katello::PuppetModule'
app/models/katello/repository_rpm.rb:    belongs_to :repository, :inverse_of => :repository_rpms, :class_name => 'Katello::Repository'
app/models/katello/repository_rpm.rb:    belongs_to :rpm, :inverse_of => :repository_rpms, :class_name => 'Katello::Rpm'
app/models/katello/sync_plan.rb:    belongs_to :organization, :inverse_of => :sync_plans
app/models/katello/subscription_facet_pool.rb:    belongs_to :subscription_facet, :inverse_of => :subscription_facet_pools, :class_name => 'Katello::Host::SubscriptionFacet'
app/models/katello/subscription_facet_pool.rb:    belongs_to :pool, :inverse_of => :subscription_facet_pools, :class_name => 'Katello::Pool'
app/models/katello/subscription_facet_activation_key.rb:    belongs_to :subscription_facet, :inverse_of => :subscription_facet_activation_keys, :class_name => 'Katello::Host::SubscriptionFacet'
app/models/katello/subscription_facet_activation_key.rb:    belongs_to :activation_key, :inverse_of => :subscription_facet_activation_keys, :class_name => 'Katello::ActivationKey'
app/models/katello/gpg_key.rb:    belongs_to :organization, :inverse_of => :gpg_keys
app/models/katello/subscription_product.rb:    belongs_to :product, :inverse_of => :subscription_products, :class_name => 'Katello::Product'
app/models/katello/subscription_product.rb:    belongs_to :subscription, :inverse_of => :subscription_products, :class_name => 'Katello::Subscription'
app/models/katello/task_status.rb:    belongs_to :organization, :inverse_of => :task_statuses, :class_name => "Organization" 
app/models/katello/task_status.rb:    belongs_to :user, :inverse_of => :task_statuses, :class_name => "::User" 
app/models/katello/task_status.rb:    belongs_to :task_owner, :polymorphic => true
app/models/katello/activation_key.rb:    belongs_to :organization, :inverse_of => :activation_keys
app/models/katello/activation_key.rb:    belongs_to :environment, :class_name => "KTEnvironment", :inverse_of => :activation_keys
app/models/katello/activation_key.rb:    belongs_to :user, :inverse_of => :activation_keys, :class_name => "::User" 
app/models/katello/activation_key.rb:    belongs_to :content_view, :inverse_of => :activation_keys
app/models/katello/content_view.rb:    belongs_to :organization, :inverse_of => :content_views, :class_name => "::Organization" 
app/models/katello/host_installed_package.rb:    belongs_to :host, :inverse_of => :host_installed_packages, :class_name => '::Host::Managed'
app/models/katello/host_installed_package.rb:    belongs_to :installed_package, :inverse_of => :host_installed_packages, :class_name => 'Katello::InstalledPackage'
app/models/katello/provider.rb:    belongs_to :organization, :inverse_of => :providers, :class_name => "Organization" 
app/models/katello/provider.rb:    belongs_to :task_status, :inverse_of => :provider
app/models/katello/kt_environment.rb:    belongs_to :organization, :class_name => "Organization", :inverse_of => :environments
app/models/katello/product.rb:    belongs_to :organization, :inverse_of => :products
app/models/katello/product.rb:    belongs_to :provider, :inverse_of => :products
app/models/katello/product.rb:    belongs_to :sync_plan, :inverse_of => :products, :class_name => 'Katello::SyncPlan'
app/models/katello/product.rb:    belongs_to :gpg_key, :inverse_of => :products
app/models/katello/product.rb:    belongs_to :ssl_ca_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_ca_products
app/models/katello/product.rb:    belongs_to :ssl_client_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_client_products
app/models/katello/product.rb:    belongs_to :ssl_client_key, :class_name => "Katello::GpgKey", :inverse_of => :ssl_key_products
app/models/katello/content_view_component.rb:    belongs_to :composite_content_view, :class_name => "Katello::ContentView",
app/models/katello/content_view_component.rb:    belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion",
app/models/katello/content_view_component.rb:    belongs_to :content_view, :class_name => "Katello::ContentView",
app/models/katello/docker_manifest_list_manifest.rb:    belongs_to :docker_manifest, :inverse_of => :docker_manifest_list_manifests, :class_name => 'Katello::DockerManifest'
app/models/katello/docker_manifest_list_manifest.rb:    belongs_to :docker_manifest_list, :inverse_of => :docker_manifest_list_manifests, :class_name => 'Katello::DockerManifestList'
app/models/katello/repository_docker_manifest_list.rb:    belongs_to :repository, :inverse_of => :repository_docker_manifest_lists, :class_name => 'Katello::Repository'
app/models/katello/repository_docker_manifest_list.rb:    belongs_to :docker_manifest_list, :inverse_of => :repository_docker_manifest_lists
app/models/katello/subscription_facet_installed_product.rb:    belongs_to :subscription_facet, :inverse_of => :subscription_facet_installed_products, :class_name => 'Katello::Host::SubscriptionFacet'
app/models/katello/subscription_facet_installed_product.rb:    belongs_to :installed_product, :inverse_of => :subscription_facet_installed_products, :class_name => 'Katello::InstalledProduct'

Related issues

Related to Katello - Bug #23209: Validate existing FK relationshipsNew2018-04-10
Blocked by Foreman - Bug #21829: Specifying wrong foreign key id for object (such as host or hostgroup) via hammer/api throws SQL errorClosed2017-11-16

History

#1 Updated by Andrew Kofink over 2 years ago

sorry, here is the list for Foreman:


app/models/cached_user_role.rb:  belongs_to :user
app/models/cached_user_role.rb:  belongs_to :role
app/models/cached_user_role.rb:  belongs_to :user_role
app/models/cached_usergroup_member.rb:  belongs_to :user
app/models/cached_usergroup_member.rb:  belongs_to :usergroup
app/models/compute_attribute.rb:  belongs_to :compute_resource
app/models/compute_attribute.rb:  belongs_to :compute_profile
app/models/table_preference.rb:  belongs_to :user
app/models/concerns/belongs_to_proxies.rb:      belongs_to name, :class_name => 'SmartProxy'
app/models/concerns/destroy_flag.rb:#    belongs_to :host
app/models/concerns/hostext/ownership.rb:      belongs_to :owner, :polymorphic => true
app/models/concerns/hostext/search.rb:      belongs_to :search_users, :class_name => 'User', :foreign_key => :owner_id
app/models/concerns/hostext/search.rb:      belongs_to :usergroups, :class_name => 'Usergroup', :foreign_key => :owner_id
app/models/concerns/host_common.rb:    belongs_to :architecture
app/models/concerns/host_common.rb:    belongs_to :environment
app/models/concerns/host_common.rb:    belongs_to :operatingsystem
app/models/concerns/host_common.rb:    belongs_to :medium
app/models/concerns/host_common.rb:    belongs_to :ptable
app/models/concerns/host_common.rb:    belongs_to :realm
app/models/concerns/host_common.rb:    belongs_to :compute_profile
app/models/concerns/host_common.rb:    belongs_to :compute_resource
app/models/concerns/has_many_common.rb:    #### belongs_to ####
app/models/concerns/audit_search.rb:    belongs_to :user, :class_name => 'User'
app/models/concerns/audit_search.rb:    belongs_to :search_users, :class_name => 'User', :foreign_key => :user_id
app/models/concerns/audit_search.rb:    belongs_to :search_hosts, -> { where(:audits => { :auditable_type => 'Host::Base' }) },
app/models/concerns/audit_search.rb:    belongs_to :search_hostgroups, :class_name => 'Hostgroup', :foreign_key => :auditable_id
app/models/concerns/audit_search.rb:    belongs_to :search_parameters, :class_name => 'Parameter', :foreign_key => :auditable_id
app/models/concerns/audit_search.rb:    belongs_to :search_templates, :class_name => 'ProvisioningTemplate', :foreign_key => :auditable_id
app/models/concerns/audit_search.rb:    belongs_to :search_ptables, :class_name => 'Ptable', :foreign_key => :auditable_id
app/models/concerns/audit_search.rb:    belongs_to :search_os, :class_name => 'Operatingsystem', :foreign_key => :auditable_id
app/models/concerns/audit_search.rb:    belongs_to :search_class, :class_name => 'Puppetclass', :foreign_key => :auditable_id
app/models/concerns/audit_search.rb:    belongs_to :search_nics, -> { where('audits.auditable_type LIKE ?', "Nic::%") }, :class_name => 'Nic::Base', :foreign_key => :auditable_id
app/models/hostgroup.rb:  belongs_to :domain
app/models/hostgroup.rb:  belongs_to :subnet
app/models/hostgroup.rb:  belongs_to :subnet6, :class_name => "Subnet" 
app/models/user.rb:  belongs_to :auth_source
app/models/user.rb:  belongs_to :default_organization, :class_name => 'Organization'
app/models/user.rb:  belongs_to :default_location,     :class_name => 'Location'
app/models/filtering.rb:  belongs_to :filter
app/models/filtering.rb:  belongs_to :permission
app/models/host/hostmix.rb:      belongs_to :host, {:class_name => "Host::Managed", :foreign_key => :host_id}.merge(options)
app/models/host/base.rb:    belongs_to :model, :name_accessor => 'hardware_model_name'
app/models/host/base.rb:    belongs_to :owner, :polymorphic => true
app/models/host/base.rb:    belongs_to :location
app/models/host/base.rb:    belongs_to :organization
app/models/host/base.rb:    belongs_to :hostgroup
app/models/host/managed.rb:  belongs_to :image
app/models/host_config_group.rb:  belongs_to :host, :polymorphic => true
app/models/host_config_group.rb:  belongs_to :config_group
app/models/hostgroup_class.rb:  belongs_to :hostgroup
app/models/hostgroup_class.rb:  belongs_to :puppetclass
app/models/image.rb:  belongs_to :operatingsystem
app/models/image.rb:  belongs_to :compute_resource
app/models/image.rb:  belongs_to :architecture
app/models/key_pair.rb:  belongs_to :compute_resource
app/models/log.rb:  belongs_to :message
app/models/log.rb:  belongs_to :source
app/models/log.rb:  belongs_to :report
app/models/lookup_keys/variable_lookup_key.rb:  belongs_to :puppetclass, :inverse_of => :lookup_keys
app/models/nic/base.rb:    belongs_to :subnet, -> { where :type => 'Subnet::Ipv4' }
app/models/nic/base.rb:    belongs_to :subnet6, -> { where :type => 'Subnet::Ipv6' }, :class_name => "Subnet" 
app/models/nic/base.rb:    belongs_to :domain
app/models/taxable_taxonomy.rb:  belongs_to :taxonomy
app/models/taxable_taxonomy.rb:  belongs_to :taxable, :polymorphic => true
app/models/personal_access_token.rb:  belongs_to :user
app/models/os_default_template.rb:  belongs_to :provisioning_template
app/models/os_default_template.rb:  belongs_to :template_kind
app/models/os_default_template.rb:  belongs_to :operatingsystem
app/models/ssh_key.rb:  belongs_to :user
app/models/usergroup_member.rb:  # we can't use custom scope definition in belongs_to because it's polymorphic, unscope(:where) would reset
app/models/usergroup_member.rb:  belongs_to :member, :polymorphic => true
app/models/usergroup_member.rb:  belongs_to :usergroup
app/models/bookmark.rb:  belongs_to :owner, :polymorphic => true
app/models/trend_counter.rb:  belongs_to :trend
app/models/filter.rb:  belongs_to :role
app/models/compute_resource.rb:  belongs_to :http_proxy
app/models/subnet_domain.rb:  belongs_to :domain
app/models/subnet_domain.rb:  belongs_to :subnet
app/models/provisioning_template.rb:  belongs_to :template_kind
app/models/template_combination.rb:  belongs_to :provisioning_template
app/models/template_combination.rb:  belongs_to :environment
app/models/template_combination.rb:  belongs_to :hostgroup
app/models/trend.rb:  belongs_to :trendable, :polymorphic => true
app/models/user_mail_notification.rb:  belongs_to :user, :inverse_of => :user_mail_notifications
app/models/user_mail_notification.rb:  belongs_to :mail_notification, :inverse_of => :user_mail_notifications
app/models/user_role.rb:  belongs_to :owner, :polymorphic => true
app/models/user_role.rb:  belongs_to :role
app/models/widget.rb:  belongs_to :user
app/models/config_group_class.rb:  belongs_to :puppetclass
app/models/config_group_class.rb:  belongs_to :config_group
app/models/host_class.rb:  belongs_to :puppetclass
app/models/external_usergroup.rb:  belongs_to :usergroup, :inverse_of => :external_usergroups
app/models/external_usergroup.rb:  belongs_to :auth_source
app/models/fact_value.rb:  belongs_to :host, {:class_name => "Host::Base", :foreign_key => :host_id}
app/models/fact_value.rb:  belongs_to :fact_name
app/models/notification.rb:  belongs_to :notification_blueprint
app/models/notification.rb:  belongs_to :initiator, :class_name => 'User', :foreign_key => 'user_id'
app/models/notification.rb:  belongs_to :subject, :polymorphic => true
app/models/notification_recipient.rb:  belongs_to :notification
app/models/notification_recipient.rb:  belongs_to :user
app/models/parameter.rb:  belongs_to :domain, :foreign_key => :reference_id, :inverse_of => :domain_parameters
app/models/parameter.rb:  belongs_to :operatingsystem, :foreign_key => :reference_id, :inverse_of => :os_parameters
app/models/parameter.rb:  belongs_to :subnet, :foreign_key => :reference_id, :inverse_of => :subnet_parameters
app/models/parameter.rb:  belongs_to :hostgroup, :foreign_key => :reference_id, :inverse_of => :group_parameters
app/models/parameter.rb:  belongs_to :location, :foreign_key => :reference_id, :inverse_of => :location_parameters
app/models/parameter.rb:  belongs_to :organization, :foreign_key => :reference_id, :inverse_of => :organization_parameters
app/models/environment_class.rb:  belongs_to :environment
app/models/environment_class.rb:  belongs_to :puppetclass
app/models/environment_class.rb:  belongs_to :puppetclass_lookup_key
app/models/lookup_value.rb:  belongs_to :lookup_key
app/models/role.rb:  belongs_to :cloned_from, :class_name => 'Role'
app/models/taxonomy.rb:  belongs_to :user

#2 Updated by Andrew Kofink over 2 years ago

  • Blocked by Bug #21829: Specifying wrong foreign key id for object (such as host or hostgroup) via hammer/api throws SQL error added

#3 Updated by Andrew Kofink over 2 years ago

  • Related to Bug #23209: Validate existing FK relationships added

Also available in: Atom PDF