Yeah. One problem I've had with the fake attribute approach is if someone
goes to update the record via the scaffold, the scaffold shows the fake
attribute boolean as unchecked and the current time for the datetime
attribute. This can be problematic and/or confusing if your end-users are
unaware or dumb. I'm not sure how to set the fake boolean attribute based on
the real datetime value after active_scaffold instantiates the object but
before its passed along to the form.

On Mon, Aug 17, 2009 at 3:49 PM, Kenny Ortmann <[email protected]>wrote:

> You could also use a fake attribute, in your model just do attr_accessor
> :date_is_nil and add it to the list of columns for active scaffold and then
> create a before filter as just suggested.
>
> ~Kenny
>
>
> On Mon, Aug 17, 2009 at 2:44 PM, Nick Rogers <[email protected]> wrote:
>
>> one way to get around this that I've used is to add a boolean attribute to
>> your model / database table, and use that as an explicit way of configuring
>> a "nil" value for the datetime column. then in your model create a
>> before_validation or whatever callback to set the datetime attribute to nil
>> if the boolean attribute is true.
>>
>>
>> On Mon, Aug 17, 2009 at 3:28 PM, Kenny Ortmann 
>> <[email protected]>wrote:
>>
>>> I don't believe this functionality exists.  I don't use the default date
>>> dropdowns.  I override my date form column in the the helper to be a regular
>>> text input field and allow the user to type the date.  If you do this the
>>> user can leave the field blank.
>>>
>>> ~Kenny
>>>
>>>
>>> On Mon, Aug 17, 2009 at 2:12 PM, Doug <[email protected]> wrote:
>>>
>>>>
>>>> Hi
>>>>
>>>> I have a date field in my model that allows nil values.  The default
>>>> edit view shows a date dropdown for day, month and year, defaulting to
>>>> today's date.  Can I tell activescaffold as part of its configuration
>>>> to allow nil values for this date field, either as a "Nil" checkbox
>>>> next to the dropdown, or as blank items in the drop downs?
>>>>
>>>> Doug
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to