Browse files

Default subunit_unit to what was set in the config

Damn you americans.
  • Loading branch information...
1 parent 1fdd5fe commit 99424accc8dc07851549ebf8ea61b2af90fd68bb @ollym ollym committed Feb 2, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/money-rails/active_record/monetizable.rb
View
6 lib/money-rails/active_record/monetizable.rb
@@ -35,12 +35,12 @@ def monetize(field, *args)
# Form target name for the money backed ActiveModel field:
# if a target name is provided then use it
- # if there is a "_cents" suffix then just remove it to create the target name
+ # if there is a "_{column.postfix}" suffix then just remove it to create the target name
# if none of the previous is the case then use a default suffix
if name
name = name.to_s
- elsif subunit_name =~ /_cents$/
- name = subunit_name.sub(/_cents$/, "")
+ elsif subunit_name =~ /#{MoneyRails::Configuration.amount_column[:postfix]}$/
+ name = subunit_name.sub(/#{MoneyRails::Configuration.amount_column[:postfix]}$/, "")
else
# FIXME: provide a better default
name = [subunit_name, "money"].join("_")

0 comments on commit 99424ac

Please sign in to comment.