Module: CFoundry::V2::Helper

Included in:
Organization, Space
Defined in:
lib/cfoundry/v2/helper.rb

Instance Method Summary collapse

Instance Method Details

#to_many_support(plural) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/cfoundry/v2/helper.rb', line 2

def to_many_support(plural)
  singular = plural.to_s.sub(/s$/, "").to_sym

  alias_method :"remove_#{singular}_without_support", :"remove_#{singular}"
  define_method(:"remove_#{singular}") do |x|
    result = self.__send__("remove_#{singular}_without_support", x)
    result.nil?
  end
end