I am getting this error when using the datebalks plugin with a
field_text call:
<%= f.text_field :effective_from,
:class => 'datebalks',
:size => 12
-%>
NoMethodError in ClientsController#update
undefined method `effective_from_text=’ for #Client:0xb6ce88c4
RAILS_ROOT: /home/byrnejb/Software/Development/Projects/proforma
Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:200:in
method_missing' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2117:in
send’
…
Request
Parameters:
{“commit”=>“Update”,
“entity”=>{“entity_legal_name”=>“Test Client Number One Ltd.”,
“entity_name”=>“The Very First Test Client”,
“entity_legal_form”=>“CORP”},
“_method”=>“put”,
“authenticity_token”=>“053225ec5f700f7ff759f8ba1e22970ac411315a”,
“client”=>{“effective_from_text”=>“yesterday”,
“client_credit_policy”=>“CASH”,
“client_status”=>“HOLD”,
“effective_from”=>“March 26,
2008”,
“superseded_after_text”=>"",
“superseded_after”=>"",
“client_credit_terms”=>“0”},
“id”=>“1”}
The author’s documentation says this:
—>
How Does it Work?
Datebalks is a small parser written in Javascript to which I’ve added a
pinch of DHTML (the same dynarch calendar) and a dash of Low-pro love
for unobtrusive elegance.
Lowpro just scans the page for input fields with a datebalks class. For
each such input, lowpro adds a hidden field and links a pop-up calendar
to it. As a programmer, all you need to do to get nice date fields is to
remember to give them the datebalks class. That’s all there is to it!
Under the covers, it transforms your date field a pair of input fields.
The original field remains visible but will be renamed by smartly
appending a _text to it’s name (it’s rails aware of course). The other
input will be hidden, will be given the original field name and will
hold the value of the parsed date in yyyy-mm-dd format. The popup
calendar and a text label are also added to provide the user a point and
click solution and some feedback.
So, my problem seems to be that these plugin generated hidden fields
(effective_date_text and superceded_date_text) are getting passed back
to the model, which of course does not have them. The blunt trauma
solution is to add them as virtual attributes to the model. My question
is, how do I get this work as described. Am I failing to do something
that the author assumes that I know about?