It was probably overlooked :\

Let's see about making enough noise to get it included... :)

-knowtheory

On Wed, Jan 7, 2009 at 3:50 PM, phatmann <[email protected]> wrote:
>
> I see that this patch did not make it into 1.0.6 nor 1.0.7. Any idea
> why? As is, bound check_boxes and radio_buttons are essentially
> broken.
>
> ..tony..
>
> On Dec 17 2008, 7:11 pm, cult hero <[email protected]> wrote:
>> I submitted the patch successfully:
>>
>> http://merb.lighthouseapp.com/projects/7433-merb/tickets/1138-patch-f...
>>
>> On Dec 17, 6:43 pm, cult hero <[email protected]> wrote:
>>
>> > I've figured out what's causing the problem with checkboxes. It
>> > appears to be unrelated to the select and radio problems. (I'll look
>> > into that later since I'm playing with the form stuff now anyway.) In
>> > the meantime, here's the problem:
>>
>> > File: merb-helpers/lib/merb-helpers/form/builders.rb
>>
>> > def considered_true?(value)
>> >   value && value != "0" && value != 0
>> > end
>>
>> > I noticed considered_true? was returning true when it didn't seem like
>> > it should. I checked the value of "value" being fed to
>> > considered_true? by update_bound_check_box and it was "false" when it
>> > should have been. So it appeared that considered_true?(false) was
>> > returning true, which made no sense. However, looking further I got
>> > this output:
>>
>> > value: false
>> > value.class: String
>> > value && value != "0" && value != 0: true
>> > value != "0": true
>> > value != 0: true
>>
>> > I presumed "value" was a boolean false. Turns out, it's a String with
>> > the value "false."
>>
>> > So, one possible solution is:
>>
>> > def considered_true?(value)
>> >   value && value != "false" && value != "0" && value != 0
>> > end
>>
>> > This works fine for me. However, what I don't know is whether value,
>> > which is retrieved from "val = control_value(method)" is supposed to
>> > be "false" (String) or false (FalseClass). Looking at control_value it
>> > appears to deliberately return a string. From what I can tell, the
>> > above solution works though since considered_true? is only called
>> > inside update_bound_check_box, so it wouldn't affect a text field with
>> > the value "false" in any weird manner.
>>
>> > I've never submitted a patch before, but I found a guide on using git
>> > and I'm going to try in just a few minutes. I'm pretty new to this
>> > whole git thing!
>>
>> > On Dec 17, 8:41 am, cult hero <[email protected]> wrote:
>>
>> > > I hope it's a bug. I'll feel better about my own skill level if it is!
>>
>> > > I try and limit the number of questions I ask around here in a day and
>> > > I'd already hit my quota just before I noticed this problem last
>> > > night. I'm hesitant to start filing any bug reports until I get some
>> > > level of confirmation here or have a higher level of competence with
>> > > Merb.
>>
>> > > On Dec 17, 12:14 am, "Yehuda Katz" <[email protected]> wrote:
>>
>> > > > This potentially sounds like a bug. I'll try and take a look at it in 
>> > > > the
>> > > > morning when I get in to work. Someone else reported a similar issue 
>> > > > with
>> > > > radio_group to me this morning so I wonder if there's something I'm 
>> > > > missing
>> > > > here.
>> > > > -- Yehuda
>>
>> > > > On Tue, Dec 16, 2008 at 10:55 PM, cult hero <[email protected]> 
>> > > > wrote:
>>
>> > > > > I started making my first forms today and things seem smooth 
>> > > > > except...
>>
>> > > > > The check_box field makes no sense to me at all. Here is the code it
>> > > > > produces:
>>
>> > > > > <input type="hidden" class="hidden" name="person[is_active]" 
>> > > > > value="0"/
>> > > > > ><input type="checkbox" class="checkbox" name="person[is_active]"
>> > > > > value="1" checked="checked" id="person_is_active"/><label
>> > > > > for="person_is_active">Is name?: </label>
>>
>> > > > > That does make sense. The trouble is, no matter what the value of
>> > > > > "is_active" is for @person, the box is ALWAYS checked. I even tried
>> > > > > adding :boolean => @person.is_active to see if that would do it, but
>> > > > > it's still checked. It works when the checkbox isn't bound to a 
>> > > > > model,
>> > > > > but when it is I get this problem. To make sure I wasn't crazy I even
>> > > > > have the value of @person.is_active display at the top of the form.
>> > > > > True or false, the checkbox is always checked.
>>
>> > > > > Is this a bug or am I just missing something ridiculously simple?
>>
>> > > > --
>> > > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to