Skip to content

Commit

Permalink
fix MiqGroup#miq_user_role_name
Browse files Browse the repository at this point in the history
virtual_delegate doesn't work too well with :through
manually unroll the delegate code

introduced in 83ad831

https://bugzilla.redhat.com/show_bug.cgi?id=1593171
  • Loading branch information
kbrock committed Jul 10, 2018
1 parent 84bec63 commit 00a5f4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/models/entitlement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class Entitlement < ApplicationRecord

validate :one_kind_of_managed_filter

virtual_delegate :name, :to => :miq_user_role, :allow_nil => true, :prefix => true

def self.valid_filters?(filters_hash)
return true unless filters_hash # nil ok
return false unless filters_hash.kind_of?(Hash) # must be Hash
Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MiqGroup < ApplicationRecord
has_many :miq_widget_sets, :as => :owner, :dependent => :destroy
has_many :miq_product_features, :through => :miq_user_role

virtual_delegate :name, :to => :miq_user_role, :allow_nil => true, :prefix => true
virtual_delegate :miq_user_role_name, :to => :entitlement, :allow_nil => true
virtual_column :read_only, :type => :boolean
virtual_has_one :sui_product_features, :class_name => "Array"

Expand Down

0 comments on commit 00a5f4d

Please sign in to comment.