Hi all,
Rails 2.1 seems to converts the following parameters
{‘birth(1i)’=‘1990’, ‘birth(2i)’=>‘2’, ‘birth(3i)’=>‘31’}
into date ‘1990-03-02’ automatically.
Is it able to inhibit this convertion?
–
makoto kuata
Hi all,
Rails 2.1 seems to converts the following parameters
{‘birth(1i)’=‘1990’, ‘birth(2i)’=>‘2’, ‘birth(3i)’=>‘31’}
into date ‘1990-03-02’ automatically.
Is it able to inhibit this convertion?
–
makoto kuata
Does anyone help me?
The following is an example to be converted invalid
date automatically (2008-02-31 -> 2008-03-02).
I want to stop this convertion.
$ ruby script/generate scaffold person name:string birth:date
$ rake db:migrate
$ ruby script/console
hash = {“name”=>“Foo”, “birth(1i)”=>“2008”, “birth(2i)”=>“2”, “birth(3i)”=>“31”}
person = Person.new(hash)
p person
#<Person id: nil, name: “Foo”, birth: “2008-03-02”, created_at: nil,
updated_at: nil>
–
makoto kuwata
makoto kuwata wrote:
Does anyone help me?
The following is an example to be converted invalid
date automatically (2008-02-31 -> 2008-03-02).
I want to stop this convertion.$ ruby script/generate scaffold person name:string birth:date
$ rake db:migrate
$ ruby script/consolehash = {“name”=>“Foo”, “birth(1i)”=>“2008”, “birth(2i)”=>“2”, “birth(3i)”=>“31”}
person = Person.new(hash)
p person
#<Person id: nil, name: “Foo”, birth: “2008-03-02”, created_at: nil,
updated_at: nil>–
makoto kuwata
There is no February 31, 2008 (2008-02-31). This year, 2008, is a leap
year so there WAS a February 29, 2008. The next day would be March 1,
2008 (February 30, 2008 by your calendar) and the day after March 2,
2008 (2008-03-02) or February 31, 2008 on your calendar. So Rails/Ruby
“fixed” it for you. If you don’t want that behaviour, use strings for
you special two extra days in February. (What are you gong to do next
year without February 29, 2009?
CEO Summary:
ROR got your back!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs