-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all check_boxes checked if collection given as array #674
Conversation
Hi, If you're currently using master (bundling from git), could you please try bundling one of the previous RC gems (e.g. 2.0.0.rc4 and/or rc3)? There have been some changes on master since rc5 shipped very much related to this part of the system, and it'd be helpful to narrow it down. |
It's broken in 2.0.0.rc5 and working as expected in 2.0.0.rc4. Want me to git bisect to find the commit that broke it? |
Sure! How about a patch too :) I have an extra busy week, so any help I can get hunting this down would be great. |
OK, I'll look into it tomorrow :) |
commit 65a1916 introduced this issue. |
@timothyklim made more changes to that code. Maybe he can explain what https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/check_boxes_input.rb#L156 is about? |
Check out my proposed fix. Unfortunately the specs for check_boxes are all failing (also before changing this), so I can hardly verify the fix with them. I have tested this in my app, where it is working fine now! |
Hi! Check this #675 |
Well, it's up to Justin now to decide on which pull request to take ;) |
IMO, it would be best to back this up with specs, but that requires getting all the checkboxes specs to pass first. |
@Thiel, it's your bug report, and I've got a massive week at work, so if you're up for it, I'd like to defer it to you to tell me what to merge in and when. "many thanks" (or "no problem") in advance :) |
My first fix wasn't correct, that's why other tests were failing. I now pulled in the fix from @timothyklim and also added a spec for this issue. Should be ready to merge now. |
So? How do we proceed with this? |
Sorry, big week. If this request is fine to merge, I'll do it straight away. |
IMO it's ready. |
Fix all check_boxes being checked if collection given as array
Many thanks! |
No, Thank you! |
…to :collection
… passed to :collection" This reverts commit bd218ed.
…to :collection
I'm running into an issue where all check_boxes are being checked no mather what the object actually is.
The bug seems to be due to https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/check_boxes_input.rb#L156
which only tries to set selected_items if collection is not given or is not an array.
I have something like this for my users, which used to work before:
Now
@user.roles
could be["admin"]
andUser::ROLES.collect {|r| [r.humanize, r]}
is[["Admin", "admin"], ["User", "user"]]
-- still both check_boxes are checked.I'm running the latests formtastic from master on Rails 3.1, Ruby 1.8.7.