From cac51cac9e6d09375ca74f98ec17a6808c77c2fe Mon Sep 17 00:00:00 2001 From: James Wong Date: Tue, 11 Jul 2017 10:50:59 -0400 Subject: [PATCH] method_missing for missing attr https://github.com/ansible/ansible_tower_client_ruby/issues/95 --- lib/ansible_tower_client/base_model.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible_tower_client/base_model.rb b/lib/ansible_tower_client/base_model.rb index 121b894..25adc27 100644 --- a/lib/ansible_tower_client/base_model.rb +++ b/lib/ansible_tower_client/base_model.rb @@ -10,6 +10,10 @@ def self.endpoint base_class.to_s.split(/::/)[1].tableize.to_s.freeze end + def method_missing(m, *args, &block) + self.class.send(:convert_value, m, args, self) + end + # Constructs and returns a new JSON wrapper class. Pass in a plain # JSON string and it will automatically give you accessor methods # that make it behave like a typical Ruby object. You may also pass