Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion How to use start_year and end_year on a date column
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Vorik  
View profile  
 More options Apr 26 2007, 2:53 am
From: Vorik <goo...@gerapeldoorn.nl>
Date: Wed, 25 Apr 2007 23:53:27 -0700
Local: Thurs, Apr 26 2007 2:53 am
Subject: Re: How to use start_year and end_year on a date column
Hi Lance,

I've found my solution using date_select. Strangely, it takes the hash
as the first element, then the key as the second. (or am i reading
this all wrong?)
Anyway, now it works fine, thanks for your help!

For future reference:
put this in the relevant helper, 'geboortedatum' is the field name
(Dutch for birthdate) and the controller is Admin::LeerlingController.
----%<-----
module Admin::LeerlingHelper
  def geboortedatum_form_column(record, input_name)
    date_select(:record, :geboortedatum, :order =>
[:day, :month, :year], :start_year => 1970, :end_year => 2000)
  end
end
----%<-----

On Apr 25, 11:00 pm, "Lance Ivy" <l...@cainlevy.net> wrote:

> The select_date method requires a Date as the first value. It's actually a
> bit confusing. Compare select_date with date_select; they're one of the form
> helper pairs that Rails has, where one accepts raw data, the other accepts
> an object and method_name.

> Ok, I'm looking back in this thread a bit and it looks like you had it
> correct before. Now that I've compared the two methods myself, the only
> change I'd suggest to the paste in your third email is to change ":prefix =>
> 'record_geboortedatum'" to ":prefix => input_name". Our patch to support the
> :name method only affected date_select et. al., and not select_date et. al.

> On 4/25/07, Vorik <goo...@gerapeldoorn.nl> wrote:

> > Hi Lance,

> > Thanks for your reply. I did check the Rails API for the select_date
> > method.

> > Can you be a bit more specific about what I'm doing wrong here?

> > Note that in post 6 I've changed your example to something that didn't
> > give an error but did not store the value in the database either.

> > Thanks again,
> > Ger.

> > On Apr 25, 5:31 pm, "Lance Ivy" <l...@cainlevy.net> wrote:
> > > Please check the Rails API for the select_date method.

> > > On 4/24/07, Vorik <goo...@gerapeldoorn.nl> wrote:

> > > > Here's the trace that is generated when I put this in app/helpers/
> > > > admin/leerling_helper.rb:
> > > > ---------------%<---------------
> > > > module Admin::LeerlingHelper
> > > >   def geboortedatum_form_column(record, input_name)
> > > >     select_date :record, :name => input_name, :order =>
> > > > [:day, :month, :year], :start_year => 1970, :end_year => 2000
> > > >   end
> > > > end
> > > > ---------------%<---------------
> > > > trace:
> > > > ---------------%<---------------
> > > > ActionView::TemplateError (undefined method `day' for :record:Symbol)
> > > > on line #3 of vendor/plugins/active_scaffold/frontends/default/views/
> > > > _form_attribute.rhtml:
> > > > 1: <% scope ||= nil %>
> > > > 2: <label for="<%= "record_#{column.name}" %>"><%= column.label %></
> > > > label>
> > > > 3: <%= form_column column, scope %>
> > > > 4: <% if column.description -%>
> > > > 5:   <span class="description"><%= column.description %></span>
> > > > 6: <% end -%>
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > helpers/date_helper.rb:229:in `select_day'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > helpers/date_helper.rb:155:in `select_date'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > helpers/date_helper.rb:154:in `select_date'
> > > >     #{RAILS_ROOT}/app/helpers/admin/leerling_helper.rb:3:in
> > > > `geboortedatum_form_column'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/helpers/
> > > > form_helpers.rb:46:in `form_column'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/frontends/default/
> > > > views/_form_attribute.rhtml:3:in

> > `_run_rhtml_47vendor47plugins47active_scaffold47frontends47default47views47 _form_attribute46rhtml'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:326:in `compile_and_render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:301:in `render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:260:in `render_file'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:275:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:59:in `render_partial_without_active_scaffold'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:58:in `render_partial_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:55:in `render_partial'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:287:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/frontends/default/
> > > > views/_form.rhtml:14:in

> > `_run_rhtml_47vendor47plugins47active_scaffold47frontends47default47views47 _form46rhtml'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/data_structures/
> > > > action_columns.rb:65:in `each'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/data_structures/
> > > > action_columns.rb:52:in `each'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/frontends/default/
> > > > views/_form.rhtml:2:in

> > `_run_rhtml_47vendor47plugins47active_scaffold47frontends47default47views47 _form46rhtml'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:326:in `compile_and_render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:301:in `render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:260:in `render_file'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:275:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:59:in `render_partial_without_active_scaffold'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:58:in `render_partial_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:55:in `render_partial'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:287:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/frontends/default/
> > > > views/_form.rhtml:6:in

> > `_run_rhtml_47vendor47plugins47active_scaffold47frontends47default47views47 _form46rhtml'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/data_structures/
> > > > action_columns.rb:65:in `each'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/data_structures/
> > > > action_columns.rb:52:in `each'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/frontends/default/
> > > > views/_form.rhtml:2:in

> > `_run_rhtml_47vendor47plugins47active_scaffold47frontends47default47views47 _form46rhtml'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:326:in `compile_and_render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:301:in `render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:260:in `render_file'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:275:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:59:in `render_partial_without_active_scaffold'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:58:in `render_partial_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:55:in `render_partial'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:287:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/frontends/default/
> > > > views/_update_form.rhtml:29:in

> > `_run_rhtml_47vendor47plugins47active_scaffold47frontends47default47views47 _update_form46rhtml'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:326:in `compile_and_render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:301:in `render_template'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:260:in `render_file'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > base.rb:275:in `render_without_active_scaffold'
> > > >     #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > > > action_view.rb:45:in `render'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/
> > > > partials.rb:59:in `render_partial_without_active_scaffold'
> > > >     /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > > > action_controller/benchmarking.rb:26:in `benchmark'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in

> ...

> read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.