Is there a built in mechanism for using to what I believe are called
'value objects' ?
The Rails docs suggest that under the hood they use their composed_of
method to do the form values to object translation.
In my own case I want a method to map duration in HH/MM/SS form fields
to a single duration_in_seconds integer
Tony
On Nov 15, 5:50 am, "Yehuda Katz" <[EMAIL PROTECTED]> wrote:
> DataMapper supports converting Hash values directly into Date objects. So
> you'll need to name your properties:
> model[date_prop][year]
> model[date_prop][month]
> model[date_prop][day]
>
> which will come into your action as {:model => {:date_prop => {:year => ...,
> :month => ..., :day => ...}} and will work transparently.
>
> -- Yehuda
>
>
>
> On Fri, Nov 14, 2008 at 9:39 PM, pgib <[EMAIL PROTECTED]> wrote:
>
> > Sorry, I should have mentioned. I'm using DataMapper.
>
> > On Nov 14, 9:23 pm, "Yehuda Katz" <[EMAIL PROTECTED]> wrote:
> > > Are you using ActiveRecord or DataMapper?
> > > -- Yehuda
>
> > > On Fri, Nov 14, 2008 at 1:52 PM, pgib <[EMAIL PROTECTED]> wrote:
>
> > > > I'm new to Merb (and Ruby) and unsure if the following is possible. I
> > > > have a model that has a Date field in it. I'd like my form to have
> > > > three select lists (month, day, year) instead of a text field for the
> > > > date entry, but I'm not sure of the best way of going about this.
> > > > Making the control itself isn't such the thing I'm having trouble
> > > > with; it's actually processing it to merge the three fields into one
> > > > value and setting the single Date field when the form submitted that
> > > > I'm not sure how to go about. I'd want to do this in a very reusable
> > > > way.
>
> > > > Any direction would be greatly appreciated.
>
> > > > Thanks,
>
> > > > Patrick
>
> > > --
> > > Yehuda Katz
> > > Developer | Engine Yard
> > > (ph) 718.877.1325
>
> --
> Yehuda Katz
> Developer | Engine Yard
> (ph) 718.877.1325
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---