1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[rackspace|auto_scale] fixing 1.8.7 incompatibility

This commit is contained in:
Kyle Rames 2013-10-08 14:08:55 -05:00
parent 1cc294c3ac
commit c9cd0c599b
2 changed files with 11 additions and 2 deletions

View file

@ -65,10 +65,14 @@ module Fog
server_template
end
def model?(obj)
obj.class.ancestors.include?(Fog::Model)
end
def get_id(type, attributes)
id = attributes["#{type}_id".to_sym]
type_key = type.to_sym
id ||= attributes[type_key].respond_to?(:id) ? attributes[type_key].id : attributes[type_key]
id ||= model?(attributes[type_key]) ? attributes[type_key].id : attributes[type_key]
end
def networks_to_hash(networks)

View file

@ -128,7 +128,12 @@ module Fog
def select_options(keys)
return nil unless @options && keys
@options.select {|k,v| keys.include?(k)}
selected = {}
keys.each do |k|
selected[k] = @options[k]
end
selected
end
end