as I said I haven't dealt with a check box on an integer column, i'm
assuming 0 is false and 1 is true, you might have to do this
def active_column(record)
checked = record.active == 1 ? true : false
check_box :record, :active, {:disabled => true, :checked => checked}
end
On Thu, Jan 29, 2009 at 10:27 PM, Kenny Ortmann <[email protected]>wrote:
> in model
> def active_column(record)
> check_box :record, :active, {:disabled => true, :checked =>
> record.active}
> end
>
>
> On Thu, Jan 29, 2009 at 9:41 PM, greghauptmann
> <[email protected]>wrote:
>
>>
>> thanks - I tried this and it didn't work, however then I check the
>> database and in fact it is the LIST view that is incorrect not the
>> EDIT view form. don't suppose you have any ideas on how to fix this
>> Kenny?
>>
>> Greg
>>
>> On Jan 30, 12:59 pm, Kenny Ortmann <[email protected]> wrote:
>> > I have only used check boxes with attributes of type boolean, but I
>> think
>> > you can do this..
>> >
>> > in your helper
>> > def active_form_helper(record, input_name)
>> > check_box :record, :active, {}, 1, 0
>> > end
>> >
>> > On Thu, Jan 29, 2009 at 7:18 PM, greghauptmann <
>> [email protected]>wrote:
>> >
>> >
>> >
>> > > Hi
>> >
>> > > I've added the following line to my controller & in the LIST view it
>> > > is fine. In the EDIT view however I note that the check box is
>> > > showing the INCORRECT state...it is displaying no tick (i.e. false) as
>> > > opposed to a tick (for true).
>> >
>> > > Is there something I'm missing? Is there some form override or
>> > > something that is required?
>> >
>> > > ------ in controller ------------
>> > > config.columns[:active].form_ui = :checkbox
>> >
>> > > ------from my migration ------
>> > > t.integer :active, :null => false
>> >
>> > > thanks
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---