Skip to content

Serialized address class for use with Rails models. Like it should be.

Notifications You must be signed in to change notification settings

nybblr/somewhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Somewhere

This gem was developed for use in a number of Rails projects. I tend to use addresses all over the place, so this gem handles all the nitpicky class level details for an address object.

Be sure to check out nybblr.com for other Rails goodies, and if you're looking for more of my gems (when I get around to it!) surf around my GitHub repos.

Subsection A: Why Somewhere?

If you're not somewhere, you're nowhere. That's a different gem.

Usage

From your ActiveRecord model, simply call the address method:

class User < ActiveRecord::Base
	# Example usages
	address

	address :billing

	address :billing, :postal_code => :zip, :include_prefix => false

end

Once you instantiate an Address object, you can convert to a hash:

address.to_hash
address.to_hash :exclude => [:country]

Or you can convert to a string:

address.to_s
address.to_s :country => false
address.to_s :delimiter => "\n"
address.to_s :multiline

About

Serialized address class for use with Rails models. Like it should be.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages