README.md in biggs-0.5.1 vs README.md in biggs-0.6.0
- old
+ new
@@ -35,23 +35,23 @@
"Yolk Sebastian Munz & Julia Soergel GbR
Musterallee 12
12345 Ausgedacht"
-### Usage with Rails and ActiveRecord
+### Usage with Class
- Address < ActiveRecord::Base
+ class Address
include Biggs
biggs :postal_address
end
This adds the method postal_address to your Address-model, and assumes the presence of the methods/columns recipient, street, city, zip, state, and country to get the address data. Country should return the ISO-code (e.g. 'us', 'fr', 'de').
You can customize the method-names biggs will use by passing in a hash of options:
- Address < ActiveRecord::Base
+ class Address
include Biggs
biggs :postal_address,
:zip => :postal_code,
:country => :country_code,
@@ -60,21 +60,21 @@
You can pass in a symbol to let biggs call a different method on your Address-model, or a Proc-object to create your data on the fly.
You can even pass in a array of symbols:
- Address < ActiveRecord::Base
+ class Address
include Biggs
biggs :postal_address,
:recipient => [:company_name, :person_name]
end
This will call the methods company_name and person_name on your address-instance, remove any blank returned values and join the rest by a line break.
To access the formatted address string, simply call the provided method on an address instance:
- Address.find(1).postal_address
+ Address.new.postal_address
If you pass in a ISO alpha 2 code as :country that is not supported by biggs, it will choose the US-format for addresses with an state specified, and the french/german format for addresses without an state.
### Supported countries