module MagicAddresses::Association::NestedInstanceMethods

module OneNamedInstanceMethods

@@named_address.each do |that|

  define_method "#{that}_attributes=" do |params|
    self.send( "#{that}=", MagicAddresses::Address.get_one( self, params ) )
  end

  define_method "#{that}_addressible_attributes=" do |params|
    self.send( "#{that}", MagicAddresses::Address.get_one( self, params[:address_attributes] ) )
  end

end if @@named_address

end #> OneNamedInstanceMethods

Public Instance Methods

address_with_build() click to toggle source

stackoverflow.com/a/4033761

# File lib/app/models/magic_addresses/association.rb, line 139
def address_with_build
  self.address_without_build || self.build_address
end