dhruvbansal / rubix

A Ruby client for configuring and writing to Zabbix
Other
25 stars 12 forks source link

Fixed bug for retrieving user_group without any users #11

Open ghost opened 11 years ago

ghost commented 11 years ago

Hi,

thanks for your great library! If encountered a bug. When you try to retrieve a user_group with has no users yet, thet map is called on nil an fails. I fixed this.

1.9.3p194 :013 > user_group = Rubix::HostGroup.find_or_create(:name => 'Customers') NoMethodError: undefined method map' for nil:NilClass from /Users/Yves/.rvm/gems/ruby-1.9.3-p194/gems/rubix-0.5.14/lib/rubix/models/host_group.rb:51:inbuild' from /Users/Yves/.rvm/gems/ruby-1.9.3-p194/gems/rubix-0.5.14/lib/rubix/models/model.rb:383:in find_or_create' from (irb):13 from /Users/Yves/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in

'