Skip to content
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

should_not allow_mass_assignment_of fails when all attributes are protected. #162

Closed
cgriego opened this issue Mar 20, 2011 · 1 comment
Closed

Comments

@cgriego
Copy link

cgriego commented Mar 20, 2011

I ran into this bug with Rails 3. I have a model where I used attr_accessible without a list of attributes to make all attributes protected. But because my white list is empty, AllowMassAssignmentOfMatcher fails to realize the model is using whitelisting so RSpec ends up throwing exceptions. The #whitelisting? check should not rely on there being an attribute white-listed.

Workaround: Make up a fake attribute. Ugly, but works.
attr_accessible :shoulda_fails_unless_there_is_at_least_one_item

@gabebw
Copy link

gabebw commented Mar 19, 2012

Looks like this is fixed in the latest version of shoulda (see here), so I"m closing. Feel free to re-open if I'm wrong.

@gabebw gabebw closed this as completed Mar 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants