On 2/16/06, Nathaniel S. H. Brown <[EMAIL PROTECTED]> wrote:
> That feature hasn't been added yet.
>
> I have a few emails outlining how someone did it, but haven't integrated it
> into a new version yet.
>
> Feel free to submit patches, or example code how you manage to do it if you
> get around to it.
>
> -Nb

I've got this working I think. I did NOT have to modify the engine.

I'm still fairly new with ruby/rails so I'm sure there are more
elegant ways to handle this.

In my partial view (_form.rhtml) I have:
<td><%= @[EMAIL PROTECTED]
date_box('date_field1') %>
<td><%= @[EMAIL PROTECTED]
date_box('date_field2') %>
<td><%= @[EMAIL PROTECTED]
date_box('date_field3') %>

As you can see I'm creating 3 distinct instance variables initialized
from my table.  Then I'm passing the name of the instance variables
into date_box.

FYI: I tried directly passing in table.date_field1, but it croaked for
some reason I don't understand.

Question:  Is there a end of line character like ; in C to allow the
above to be on one line each?

With the above the existing unmodified engine causes the 3 new
instance variables to be available as params so in my controller I
updated my update and create methods to have:
@table.date_field1 = params[:date_field1]
@table.date_field2 = params[:date_field2]
@table.date_field3 = params[:date_field3]

The above is immediately after the table.find(params[:id])  line in
both the update and create methods.

I never did get the automatic database field updating feature to work
with even a single date.  For someone that has that feature working
maybe they could eliminate having to add the extra lines to the update
method.

HTH
Greg
--
Greg Freemyer
_______________________________________________
engine-users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org

Reply via email to