Hey Isak,

I currently working on the same problem. In my last projects I have 
workaround with an own setter for the numbers. e.g.

the active-record model
class Article
  def price=(value)
    self.price = value.to_delocalized_decimal
  end
end

and the String-class extension:

class String
  def to_delocalized_decimal
    return self if !self.is_a?(String) or self.blank?
    BigDecimal.new(string.sub(',', '.'))
  end
end

maybe this is usefull for your research-program. But i guess its better 
to use extra methods to fill your database-field. In this case the 
output would be also localized. e.g.

def localized_price=(value)
  self.price = value.to_delocalized_decimal
end
def localized_price
  price.to_delocalized_decimal # use another BigDecimal-extension
end


and the premium-version would be an ActiveRecord::Base-extension. Any 
suggestions how to build such a plugin?

cheerio
benni


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion@rubyforge.org
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to