Using date_box

I’m trying to figure out how to use the datebox_engine in an edit view.
I’m still new at this, so my terminology might be slightly off here;
please bare with me :slight_smile:

I can drop datebox in to my _form.rhtml, per the README’s instructions,
with

<%= date_box %>

And by adding

<% @dateField = @work_item.date %>

immediately before the date_box line in my _form.rhtml, I can set the
default value to be the “date” attribute of the object I am editing.

So far so good.

Where I’m getting stuck, however, is figuring out how to set the input
name for the date_box. By default, it wants to be “dateField”, and
according to the README, I can change this in my environment.rb with

module DateboxEngine
    config :elementId, "someNewValue"
end

(Actually, the README states this is how to change the input ID.
However, it appears that the input name changes to match the ID.)

However, I want the input name to be “work_item[date]”. If I do

config :elementId, "work_item[date]"

I then get:

`@work_item[date]' is not allowed as an instance variable name
Extracted source (around line #7):
4: <p><label for="work_item_date">Date</label><br/>
5:
6:
7: <%= date_box %></p> 8: 9: <p><label

for=“work_item_hours”>Hours
10: <%= text_field ‘work_item’,
‘hours’ %>

Trace of template inclusion: /app/views/work_items/edit.rhtml
RAILS_ROOT: /Users/arakune/Sites/Margaret/public/../config/..
Application Trace <http://localhost:3000/work_items/edit/1#> |

Framework Trace http://localhost:3000/work_items/edit/1# | Full Trace
http://localhost:3000/work_items/edit/1#

/Users/arakune/Sites/Margaret/vendor/plugins/datebox_engine/app/helpers/application_helper.rb:8:in
`instance_variable_get’

/Users/arakune/Sites/Margaret/vendor/plugins/datebox_engine/app/helpers/application_helper.rb:8:in
date_box' #{RAILS_ROOT}/app/views/work_items/_form.rhtml:7:in_run_rhtml_work_items__form’
#{RAILS_ROOT}/app/views/work_items/edit.rhtml:4:in
`_run_rhtml_work_items_edit’

Is there something that I’m missing here?

Thanks in advance!

Gwen

|/Users/arakune/Sites/Margaret/vendor/plugins/datebox_engine/app/helpers/application_helper.rb:8:in instance_variable_get' /Users/arakune/Sites/Margaret/vendor/plugins/datebox_engine/app/helpers/application_helper.rb:8:indate_box’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:314:in
compile_and_render_template' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:290:inrender_template’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:249:in
render_file' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:264:inrender’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/partials.rb:59:in
render_partial' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:29:inbenchmark’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:293:in
measure' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:307:inrealtime’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:29:in
benchmark' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/partials.rb:58:inrender_partial’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:276:in
render' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:314:incompile_and_render_template’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:290:in
render_template' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:249:inrender_file’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:699:in
render_file' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:621:inrender_with_no_layout’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/layout.rb:243:in
render_without_benchmark' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:53:inrender’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:293:in
measure' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:53:inrender’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:911:in
perform_action_without_filters' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:368:inperform_action_without_benchmark’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/rescue.rb:82:inperform_action’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:381:in
process_without_filters' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:377:inprocess_without_session_management_support’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session_management.rb:117:in
process' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:indispatch’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:150:in
process_request' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:54:inprocess!’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in
each_cgi' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:ineach_cgi’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:53:in
process!' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:23:inprocess!’
/Users/arakune/Sites/Margaret/public/dispatch.fcgi:24|

|/Users/arakune/Sites/Margaret/vendor/plugins/datebox_engine/app/helpers/application_helper.rb:8:in instance_variable_get' /Users/arakune/Sites/Margaret/vendor/plugins/datebox_engine/app/helpers/application_helper.rb:8:indate_box’
#{RAILS_ROOT}/app/views/work_items/_form.rhtml:7:in
_run_rhtml_work_items__form' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:314:incompile_and_render_template’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:290:in
render_template' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:249:inrender_file’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:264:in
render' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/partials.rb:59:inrender_partial’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:29:in
benchmark' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:307:in
realtime' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:29:inbenchmark’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/partials.rb:58:in
render_partial' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:276:inrender’
#{RAILS_ROOT}/app/views/work_items/edit.rhtml:4:in
_run_rhtml_work_items_edit' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:314:incompile_and_render_template’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:290:in
render_template' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_view/base.rb:249:inrender_file’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:699:in
render_file' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:621:inrender_with_no_layout’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/layout.rb:243:in
render_without_benchmark' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:53:inrender’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:293:in
measure' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:53:inrender’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:911:in
perform_action_without_filters' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:368:inperform_action_without_benchmark’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/rescue.rb:82:inperform_action’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:381:in
process_without_filters' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:377:inprocess_without_session_management_support’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session_management.rb:117:in
process' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:indispatch’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:150:in
process_request' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:54:inprocess!’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:600:in
each_cgi' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.rb:597:ineach_cgi’
/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:53:in
process!' /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:23:inprocess!’
/Users/arakune/Sites/Margaret/public/dispatch.fcgi:24|

Gwen,

Please read this post from me a few days ago - it will make your
implementation a little easier. If it doesn’t work, please email me at
codeslush at yahoo dot com because I don’t check the “engines” forum
regularly.

http://www.ruby-forum.com/topic/75271#new

Thanks,

Michael

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs