Closed GoogleCodeExporter closed 9 years ago
Fixed in a275c7ffadd5d1a6c07a7791572d53f68d83da12
Original comment by sergio.c...@gmail.com
on 26 May 2010 at 7:49
No, it only works when input value with native separator. For example:
1.3 becomes 1,300
but 1,3 becomes 13,000
Original comment by VoronkovAA@gmail.com
on 26 May 2010 at 9:12
[deleted comment]
Have you updated and restarted the application? I can't reproduce it and also I
have
some tests for your configuration with no fail
Original comment by sergio.c...@gmail.com
on 26 May 2010 at 9:37
You can run the tests from your active_scaffold directory:
cd vendor/plugins/active_scaffold
rake
Original comment by sergio.c...@gmail.com
on 26 May 2010 at 9:40
That's what I see in my console, when creating a new record:
Processing FinancingsController#create (for 127.0.0.1 at 2010-05-26 22:48:25)
[POST]
Parameters: {"commit"=>"Создать запись",
"authenticity_token"=>"zbxflMyF0Awvo2IXRBvGuGlNwX73dHvsXQYzO4kN18o=", "_"=>"",
"record"=>{"current_regional_budget"=>"1.1", "extrabudgetary"=>"0",
"date(1i)"=>"2010", "date(2i)"=>"5", "date(3i)"=>"1",
"old_regional_budget"=>"0",
"local_budget"=>"0", "federal_budget"=>"1,1"}}
User Columns (0.6ms) SHOW FIELDS FROM `users`
User Load (0.2ms) SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
SQL (0.1ms) BEGIN
Financing Create (0.2ms) INSERT INTO `financings` (`current_regional_budget`,
`name`, `extrabudgetary`, `created_at`, `event_id`, `updated_at`,
`district_id`,
`old_regional_budget`, `date`, `type`, `federal_budget`, `local_budget`,
`parent_id`)
VALUES(1.1, NULL, 0.0, '2010-05-26 12:48:25', NULL, '2010-05-26 12:48:25',
NULL, 0.0,
'2010-05-01', NULL, 11.0, 0.0, NULL)
Original comment by VoronkovAA@gmail.com
on 26 May 2010 at 1:27
It.is strange because in console:
>> separator = ","
=> ","
>> a = "1,1"
=> "1,1"
>> a.gsub(/[^0-9\-#{separator}]/, '').gsub(separator, '.')
=> "1.1"
>> a.gsub(/[^0-9\-#{separator}]/, '').gsub(separator, '.').to_d
#<BigDecimal:b5d9fb4c,'0.11E1',8(8)>
Original comment by VoronkovAA@gmail.com
on 26 May 2010 at 1:29
[deleted comment]
What is there in line 130 of lib/active_scaffold/attribute_params.rb?
It should be:
unless !value.include?(separator) && value.include?(native) && (delimiter !=
native
|| value !~ /\.\d{3}$/)
Original comment by sergio.c...@gmail.com
on 26 May 2010 at 3:20
Yes, I have this string
Original comment by VoronkovAA@gmail.com
on 26 May 2010 at 10:24
My AS is at a3b61a3e88b8cce538b0f240681a1da2844118ec now.
And I tried to turn off all of the localization and add
en:
number:
currency:
format:
format: "%n"
unit: "руб."
separator: ","
delimiter: ""
precision: 3
the same thing in non localized app.
Original comment by VoronkovAA@gmail.com
on 26 May 2010 at 10:40
At last! I've just understand where is an error.
It's in line 128 of attribute_params.rb:
separator = I18n.t('number.format.separator')
But if I want to change only currency appearance, it should be
separator = I18n.t('number.currency.format.separator')
but you have both [:i18n_number, :currency].include? in condition and only one
definition of separator and delimiter and it is for :i18n_number, so for
:currency it
taks wrong value (In my case separator = ".")
And I think in line 130 you should change #{I18n.t('number.format.separator')}
to
just #{separator}
Original comment by VoronkovAA@gmail.com
on 26 May 2010 at 11:54
I've just made a patch and submitted a pull request.
Original comment by VoronkovAA@gmail.com
on 27 May 2010 at 1:41
Thanks, I have merged and improved to support :percentage and :size too, because
they were supported in list and forms, but they weren't converted to native
format.
Original comment by sergio.c...@gmail.com
on 27 May 2010 at 8:42
Original issue reported on code.google.com by
VoronkovAA@gmail.com
on 26 May 2010 at 12:06