How to use start_year and end_year on a date column

23 views
Skip to first unread message

Vorik

unread,
Apr 16, 2007, 2:01:04 AM4/16/07
to ActiveScaffold : Ruby on Rails plugin
Hi all,

I'm trying to insert a record containing a birthdate with
activescaffold. However, the year-dropdown box is only showing years
starting from 2002. This means that people over 5 years old cannot use
the application which, unfortunately, does not meet the functional
requirements. (Would save lots of difficult questions though!)

How can I set the starting year? With standard rails it is set like
this:

date_select :geboortedatum, :order =>
[:day, :month, :year], :start_year => 1970, :end_year => 2000

The funny thing is that in 'edit mode', the years start at 1969 but in
'new' mode it starts at 2002.

Thanks in advance,
Ger Apeldoorn

Lance Ivy

unread,
Apr 16, 2007, 2:30:28 PM4/16/07
to actives...@googlegroups.com
Hi Ger,

Your best bet here is probably to override the column on the form and customize it exactly how you want it. Check out http://activescaffold.com/docs/form-overrides .

Vorik

unread,
Apr 17, 2007, 3:30:46 AM4/17/07
to ActiveScaffold : Ruby on Rails plugin
Thanks for the tip Lance, but I'm not there yet.... This is what I've
come up with:

---------------leerling_helper.rb---------------
module Admin::LeerlingHelper
def geboortedatum_form_column(record, input_name)
select_date record[:geboortedatum], :name =>
'geboortedatum', :order => [:day, :month, :year], :start_year =>
1970, :end_year => 2000
end
end
---------------/leerling_helper.rb---------------

The override is beiing used (order changed), but the values are not
beiing stored to the database.

I think it is because of the select's name. Here is an excerpt of the
html-source that is generated:
---------------%<---------------
<label for="record_geboortedatum">Geboortedatum</label>
<select id="date_day" name="date[day]">
<option value="1">1</option>
<option value="2">2</option>
---------------%<---------------

Shouldn-t that be name="geboortedatum[day]"?

how can I change it?

Many thanks,
Ger.

Vorik

unread,
Apr 17, 2007, 6:10:05 AM4/17/07
to ActiveScaffold : Ruby on Rails plugin
I'm a bit further. Now I'm using (in the helper)

select_date record[:geboortedatum], :prefix =>
'record_geboortedatum', :order => [:day, :month, :year], :start_year


=> 1970, :end_year => 2000

This makes the code for the select like this (note the name field):
---------------%<---------------
<select id="record_geboortedatum_day"
name="record_geboortedatum[day]">
---------------%<---------------

Without the override in the helper (which does save the values in the
DB):
---------------%<---------------
<select id="record_geboortedatum_1i" name="record[geboortedatum(1i)]">
---------------%<---------------

My code gives the value in a hash (record_geboortedatum[day]). It
SHOULD give the value back in a hash(?) which is itself in the record
hash. (record[geboortedatum(1i)])

How can I achieve this little miracle???

Greetings & Salutations,
Ger.

On 17 apr, 09:30, Vorik <goo...@gerapeldoorn.nl> wrote:
> Thanks for the tip Lance, but I'm not there yet.... This is what I've
> come up with:
>
> ---------------leerling_helper.rb---------------
> module Admin::LeerlingHelper
> def geboortedatum_form_column(record, input_name)

> select_daterecord[:geboortedatum], :name =>

Lance Ivy

unread,
Apr 17, 2007, 12:09:58 PM4/17/07
to actives...@googlegroups.com
we added a :name option to the date/time selects so that you can use the provided input_name. try:

select_date :record, :name => input_name, ...

Vorik

unread,
Apr 18, 2007, 1:44:38 AM4/18/07
to ActiveScaffold : Ruby on Rails plugin
Hi Lance,

Unfortunately, your example gives an error(ActionView::TemplateError
(undefined method `day' for :record:Symbol)). I've changed :record to
record[:geboortedatum].

select_date record[:geboortedatum], :name => input_name, :order =>


[:day, :month, :year], :start_year => 1970, :end_year => 2000

does not store the values in the database.....

This is the HTML source:


<label for="record_geboortedatum">Geboortedatum</label>
<select id="date_day" name="date[day]">
<option value="1">1</option>

Your help is very much appreciated!!

Thanks,
Ger.

Vorik

unread,
Apr 23, 2007, 2:57:54 AM4/23/07
to ActiveScaffold : Ruby on Rails plugin
Hi again,

This is still a problem for me, any insights (or pointers to some
working code) are very much appreciated!!

Thanks,
Ger.

Lance Ivy

unread,
Apr 23, 2007, 11:32:34 AM4/23/07
to actives...@googlegroups.com
Could you check the stack trace? That looks like a completely different exception.

LitFuse

unread,
Apr 24, 2007, 8:53:12 AM4/24/07
to ActiveScaffold : Ruby on Rails plugin
I have a similar problem,

In the Helper I added

module AssetsHelper
def date_received_form_column(record, input_name)
select_date record[:date_received],:name=>input_name, :include_blank
=> true
end

To create a "null" on the drop down... The null now appears in tho
HTML, and the data is reformatted correctly. But, the date is never
updated in the database (for Nulls or any data changes)
.
The log has no errors, but the trace record is below ... Note that I
do have numerous dates, the only one overriden is "Date_recieved" ...
It was set to 4/2/2000 .. But alas, no update to the database.

Note that the trace shows date"=>{"month"=>"4", "day"=>"2",
"year"=>"2000"}, seems to refer to the "date_received" which I set to
4/2/2000 ..

Processing AssetsController#update (for 127.0.0.1 at 2007-04-24
08:41:10) [PUT]
Session ID: 312a7c8f9387cb3ba443304768084054
Parameters: {"commit"=>"Update", "date"=>{"month"=>"4", "day"=>"2",
"year"=>"2000"}, "_method"=>"put", "action"=>"update", "id"=>"7",
"controller"=>"assets", "associated_id"=>"",
"record"=>{"name"=>"0004569", "date_excessed(5i)"=>"00",
"orig_cost"=>"0",
"issuances"=>{"1177418430937"=>{"date_installed(5i)"=>"40",
"Orig_Issuance"=>"", "patch_method"=>{"id"=>""},
"date_removed(1i)"=>"2007", "date_removed(2i)"=>"4",
"date_installed(1i)"=>"2007", "use"=>{"id"=>""},
"date_removed(3i)"=>"24", "customer"=>{"id"=>""},
"date_installed(2i)"=>"4", "named_server"=>{"id"=>""},
"date_installed(3i)"=>"24", "date_removed(4i)"=>"08",
"room"=>{"id"=>""}, "lan_desk"=>"false", "date_installed(4i)"=>"08",
"holding_account"=>{"id"=>""}, "date_removed(5i)"=>"40"},
"4707"=>{"date_installed(5i)"=>"26", "Orig_Issuance"=>"",
"id"=>"4707", "patch_method"=>{"id"=>""}, "date_removed(1i)"=>"2007",
"date_removed(2i)"=>"4", "date_installed(1i)"=>"2007",
"use"=>{"id"=>""}, "customer"=>{"id"=>""}, "date_removed(3i)"=>"24",
"date_installed(2i)"=>"4", "room"=>{"id"=>""}, "lan_desk"=>"false",
"named_server"=>{"id"=>""}, "date_removed(4i)"=>"08",
"date_installed(3i)"=>"24", "date_installed(4i)"=>"08",
"holding_account"=>{"id"=>""}, "date_removed(5i)"=>"26"},
"4708"=>{"date_installed(5i)"=>"30", "Orig_Issuance"=>"",
"id"=>"4708", "patch_method"=>{"id"=>""}, "date_removed(1i)"=>"2007",
"date_removed(2i)"=>"4", "date_installed(1i)"=>"2007",
"use"=>{"id"=>""}, "date_removed(3i)"=>"24", "customer"=>{"id"=>""},
"date_installed(2i)"=>"4", "named_server"=>{"id"=>""},
"room"=>{"id"=>""}, "date_removed(4i)"=>"08",
"date_installed(3i)"=>"24", "lan_desk"=>"false",
"holding_account"=>{"id"=>""}, "date_removed(5i)"=>"30",
"date_installed(4i)"=>"08"}}, "date_last_inventory(1i)"=>"2007",
"date_last_inventory(2i)"=>"4", "date_last_inventory(3i)"=>"24",
"date_last_inventory(4i)"=>"08", "tagged"=>"false",
"date_last_inventory(5i)"=>"26", "date_excessed(1i)"=>"2003",
"orig_po"=>"dr = 2000\\4\\2", "date_excessed(2i)"=>"4",
"date_excessed(3i)"=>"1", "xmodel"=>{"name"=>"HP LaserJet Series II",
"brand"=>{"id"=>"26"}, "category"=>{"id"=>"6"},
"model_specs"=>{"514"=>{"id"=>"430"}}, "id"=>"300",
"standard"=>{"id"=>"40"}, "part_number"=>"33440A"},
"date_excessed(4i)"=>"00"}}

Vorik

unread,
Apr 25, 2007, 1:59:05 AM4/25/07
to ActiveScaffold : Ruby on Rails plugin
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 `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_controller/base.rb:850:in `render_partial'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/base.rb:762:in `render_with_no_layout'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/layout.rb:256:in `render_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/benchmarking.rb:50:in
`render_without_active_scaffold'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/benchmarking.rb:50:in
`render_without_active_scaffold'
#{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
action_controller.rb:13:in `render'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/base.rb:786:in `render_to_string'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/
deprecation.rb:43:in `silence'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/base.rb:786:in `render_to_string'
#{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
action_controller.rb:9:in `render'
#{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/actions/update.rb:
22:in `edit'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/mime_responds.rb:135:in `custom'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/mime_responds.rb:167:in `respond'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/mime_responds.rb:161:in `respond'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/mime_responds.rb:105:in `respond_to'
#{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/actions/update.rb:
13:in `edit'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/base.rb:1095:in `perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:632:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:438:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:634:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:438:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:438:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:634:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:438:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:438:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:438:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:449:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:619:in `perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/rescue.rb:83:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/base.rb:430:in `process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/filters.rb:624:in
`process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/session_management.rb:114:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/base.rb:330:in `process'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/dispatcher.rb:41:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:
78:in `process'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:
76:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in
`process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
`process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
configurator.rb:271:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
configurator.rb:270:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:
211:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243
/usr/bin/mongrel_rails:18


Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
action_controller/templates/rescues/layout.rhtml (500 Internal Error)
---------------%<---------------

Lance Ivy

unread,
Apr 25, 2007, 11:31:19 AM4/25/07
to actives...@googlegroups.com
Please check the Rails API for the select_date method.

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/
    /usr/lib/ruby/gems/1.8/gems/mongrel- 1.0.1/lib/mongrel.rb:618:in

Lance Ivy

unread,
Apr 25, 2007, 11:53:43 AM4/25/07
to actives...@googlegroups.com
Looks like this problem is caused by the difference between the :select_date method and the :date_select method. Kinda confusing, actually, but they're pretty different. We patched support into :date_select (and its siblings :datetime_select and :time_select) for the :name parameter, but :select_date et. al. use their own routines. So I'm taking a look at patching support for :name into those, too.

Lance Ivy

unread,
Apr 25, 2007, 12:04:18 PM4/25/07
to actives...@googlegroups.com
Ugh, it doesn't look like we can patch select_date/select_time/select_datetime to support the :name parameter without completely overriding those methods. However, those methods do support :prefix, which functions exactly like :name would function.

So try:

module AssetsHelper
  def date_received_form_column(record, input_name)
    select_date record[:date_received], :prefix => input_name, :include_blank => true
  end
end

Vorik

unread,
Apr 25, 2007, 4:41:27 PM4/25/07
to ActiveScaffold : Ruby on Rails plugin
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.

> > 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'

> > #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > action_controller.rb:13:in `render'
> > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > action_controller/base.rb:786:in `render_to_string'
> > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/
> > deprecation.rb:43:in `silence'
> > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/
> > action_controller/base.rb:786:in `render_to_string'
> > #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/extensions/
> > action_controller.rb:9:in `render'
> > #{RAILS_ROOT}/vendor/plugins/active_scaffold/lib/actions/update.rb:
> > 22:in `edit'
>

> ...
>
> read more »

Lance Ivy

unread,
Apr 25, 2007, 5:00:04 PM4/25/07
to actives...@googlegroups.com
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.

> > 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 `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/
> read more �





Vorik

unread,
Apr 26, 2007, 2:53:27 AM4/26/07
to ActiveScaffold : Ruby on Rails plugin
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
----%<-----

> > > > 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 »

Reply all
Reply to author
Forward
0 new messages