RubyMoney/money-rails — pull request #117 by paolodona (2013-07-04 22:47:43+00:00)
Title: Pick instance currency from column defined by config.currency_column[:column_name], instead of defaulting to "currency"

This allows the currency of new AR instances to be picked from a column named something different from "currency". I need this because the currency colum in my database is called "currency_code", not "currency".

config.currency_column = { column_name: 'currency_code', ... }

I have a model defined like this:

# table job_types
# hourly_rate_cents
# currency_code - as specified in config.currency_column
class JobType
monetize :hourly_rate_cents
end

job_type = JobType.new :currency_code => "EUR"
job_type.hourly_rate.currency.iso_code #=> "USD" -- This is wrong, because I've specified in config what the currency column should be

The current implementation does not use the currency_column configuration to decide which column needs to be inspected. This patch solves this particular problem.