Module: Rubix::Associations::HasManyHostGroups
Instance Method Summary collapse
- #host_group_ids ⇒ Object
- #host_group_ids=(hgids) ⇒ Object
- #host_group_params ⇒ Object
- #host_groups ⇒ Object
- #host_groups=(hs) ⇒ Object
Instance Method Details
#host_group_ids ⇒ Object
22 23 24 25 26 |
# File 'lib/rubix/associations/has_many_host_groups.rb', line 22 def host_group_ids return @host_group_ids if @host_group_ids return unless @host_groups @host_group_ids = @host_groups.map(&:id) end |
#host_group_ids=(hgids) ⇒ Object
17 18 19 20 |
# File 'lib/rubix/associations/has_many_host_groups.rb', line 17 def host_group_ids= hgids return unless hgids @host_group_ids = hgids end |
#host_group_params ⇒ Object
28 29 30 31 |
# File 'lib/rubix/associations/has_many_host_groups.rb', line 28 def host_group_params return [] unless host_group_ids host_group_ids.map { |hid| { 'groupid' => hid } } end |
#host_groups ⇒ Object
11 12 13 14 15 |
# File 'lib/rubix/associations/has_many_host_groups.rb', line 11 def host_groups return @host_groups if @host_groups return unless @host_group_ids @host_groups = @host_group_ids.map { |hgid| HostGroup.find(:id => hgid) } end |
#host_groups=(hs) ⇒ Object
5 6 7 8 9 |
# File 'lib/rubix/associations/has_many_host_groups.rb', line 5 def host_groups= hs return unless hs @host_groups = hs @host_group_ids = hs.map(&:id) end |