Skip to content
Browse files

Update documentation for 0.4.0 version

  • Loading branch information...
1 parent 6601607 commit 18bdd59ac078f66ae90232724d99b856cced57f7 @alup alup committed Jun 22, 2012
Showing with 59 additions and 0 deletions.
  1. +59 −0 README.md
View
59 README.md
@@ -69,6 +69,22 @@ Now the model objects will have a ```discount``` attribute which
is a Money object, wrapping the value of ```discount_subunit``` column to a
Money instance.
+### Allow nil values
+
+If you want to allow the assignment of nil and/or blank values to a specific
+monetized field, you can use the `:allow_nil` parameter like this:
+
+```
+# in Product model
+monetize :optional_price_cents, :allow_nil => true
+
+# then blank assignments are permitted
+product.optional_price = nil
+product.save # returns without errors
+product.optional_price # => nil
+product.optional_price_cents # => nil
+```
+
### Currencies
Money-rails supports a set of options to handle currencies for your
@@ -221,6 +237,49 @@ end
* ```default_bank```: The default bank object holding exchange rates etc.
(https://github.com/RubyMoney/money#currency-exchange)
+### Helpers
+
+* the `currency_symbol` helper method
+
+```
+<%= currency_symbol %>
+```
+This will render a `span` dom element with the default currency symbol.
+
+* the `humanized_money` helper method
+
+```
+<%= humanized_money @money_object %>
+```
+This will render a formatted money value without the currency symbol and
+without the cents part if it contains only zeros (uses
+`:no_cents_fi_whole flag`).
+
+* humanize with symbol helper
+
+```
+<%= humanized_money_with_symbol @money_object %>
+```
+This will render a formatted money value including the currency symbol and
+without the cents part if it contains only zeros.
+
+* get the money value without the cents part
+
+```
+<%= money_without_cents @money_object %>
+```
+This will render a formatted money value without the currency symbol and
+without the cents part.
+
+* get the money value without the cents part and including the currency
+ symbol
+
+```
+<%= money_without_cents_and_with_symbol @money_object %>
+```
+This will render a formatted money value including the currency symbol and
+without the cents part.
+
## Maintainers
* Andreas Loupasakis (https://github.com/alup)

0 comments on commit 18bdd59

Please sign in to comment.
Something went wrong with that request. Please try again.