There is a bug here when I use a birthday date picker like

  def birthday_form_column(record, input_name)
    date_select :record, :birthday, :discard_year =>
true, :include_blank => true
  end

I get an exception if I try to choose February 27. Is it because Date
interprets 27 as the month?

Processing AdminController#update (for 127.0.0.1 at 2008-11-18
09:23:14) [PUT]
  Session ID:
BAh7CCINYXM6YWRtaW57BjoJbGlzdHsGIglwYWdlaQY6DGNzcmZfaWQiJWNi
NjIxNDMzNjk5MzIzNGI1YWNhNjg2NzNkZjA2NTBhIgpmbGFzaElDOidBY3Rp
b25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--
f240738f30f265617ab682cb1961e52ff6ef0179
  Parameters: {"commit"=>"Update",
"authenticity_token"=>"f9ac2adb4171d5ef3ceb6f703641591e09de03aa",
"_method"=>"put", "action"=>"update", "id"=>"6",
"controller"=>"admin", "record"=>{"address"=>"586",
"city"=>"cityname", "zip"=>"82000", "birthday(1i)"=>"", "birthday
(2i)"=>"2", "birthday(3i)"=>"27", "password_confirmation"=>"",
"admin"=>"1", "state_name"=>"yu", "home_phone"=>"801-555-5555",
"email2"=>"", "last_name"=>"last", "mobile2_phone"=>"",
"login"=>"logname", "password"=>"", "first_name"=>"first",
"email"=>"[EMAIL PROTECTED]", "mobile_phone"=>""}}
  User Load (0.003174)   SELECT * FROM "users" WHERE ("users"."id" =
6)


ActiveRecord::MultiparameterAssignmentErrors (1 error(s) on assignment
of multiparameter attributes):
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/
base.rb:2669:in `execute_callstack_for_multiparameter_attributes'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/
base.rb:2630:in `assign_multiparameter_attributes'
    /vendor/plugins/active_scaffold/lib/attribute_params.rb:51:in
`send'
    /vendor/plugins/active_scaffold/lib/attribute_params.rb:51:in
`update_record_from_params'
    /vendor/plugins/active_scaffold/lib/data_structures/
action_columns.rb:69:in `each'
    /vendor/plugins/active_scaffold/lib/data_structures/
action_columns.rb:56:in `each'
    /vendor/plugins/active_scaffold/lib/attribute_params.rb:49:in
`update_record_from_params'


On Oct 3, 8:17 am, bmidgley <[EMAIL PROTECTED]> wrote:
> Hey
>
> This mostly behaves, but the first time I add a birthdate to a user,
> month and date are reversed! So I set the birthdate to January 11,
> then after saving and returning, it's November 1! Both forms post with
> month in "2i" and date in "3i" but somewhere it's being interpreted
> backwards.
>
> I got the latest AS about two weeks ago; using with rails 2.1.1.
>
> Brad
>
> On Sep 21, 11:01 pm, bmidgley <[EMAIL PROTECTED]> wrote:
>
> > Hey
>
> > This was fairly simple so I'll just reply to myself. I gave up on a
> > custom sort. The regular sort is good enough and better-behaved than
> > something that works from the current date.
>
> > This all falls in the admin helper.
>
> > $ cat app/helpers/admin_helper.rb
> > module AdminHelper
> >   def birthday_form_column(record, input_name)
> >     date_select :record, :birthday, :discard_year =>
> > true, :include_blank => true
> >   end
>
> >   def birthday_column(record)
> >     record.birthday ? "#{record.birthday.month}/
> > #{record.birthday.day}" : ""
> >   end
> > end
>
> > Brad
>
> > On Sep 20, 10:18 pm, "Brad Midgley" <[EMAIL PROTECTED]> wrote:
>
> > > Hey
>
> > > What is the best way to get a "birthday" date picker?
>
> > > - It would not show year or time in picker
> > > - if date value is null, don't default to saving today's date in the
> > > field--leave it null
> > > - sorting by this field would ideally show you records in the order
> > > that birthdays are coming up
>
> > > --
> > > Brad
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to