Fix Paranoia to work with validates_uniquness_of (rails3 branch)#122
Conversation
|
@codeodor The build on this PR passes. Does that mean that you've fixed it? |
|
It was #121 that was failing, I guess. Locally it passes all the tests on Rails 4.0.2 and Ruby 2.0, but the build shows failures due to For the failing test, I have no idea why it would pass locally and on the 4.1 tests. For the error, I think that test needs to be rewritten (but has nothing to do with this PR). And actually, now that I look at the most recent build it appears to have the same two issues, so I'd say both are ready to go, with the two tests being a separate issue. |
|
Oh, and as far as "fixed it" then yes, I did fix the issue raised in #114 on both the Rails 3 branch (this PR) and the Rails 4 branch (#121). At first I thought by "fixed it" you might have been referring to the build failures on the Rails 4 branch that I mentioned in the original issue. |
|
Any status update as to when this might get merged in? Thanks! |
|
I will rebase it when I get a chance. |
So the project can run tests after `bundle install`
|
Ok, all done. |
|
This will also fix #175 |
|
Travis is happy. I am happy. Let's merge it. |
Fix Paranoia to work with validates_uniquness_of (rails3 branch)
|
👍 Thank you! |
|
Not sure of the details yet, but after using this merged version my uniqueness validation stopped working. It allows me to add multiple records with the same value. I know as part of this PR there's a test to ensure that |
|
So, change: def test_validates_uniqueness_only_checks_non_deleted_records
a = Employer.create!(name: "A")
a.destroy
b = Employer.new(name: "A")
assert b.valid?
endTo this: def test_validates_uniqueness_only_checks_non_deleted_records
a = Employer.create!(name: "A")
b = Employer.new(name: "A")
assert_not b.valid?
a.destroy
assert b.valid?
end |
|
Created #246 to deal with that. Thanks @joshuapinter |
Fix "normal" validates_uniqueness_of after #122 broke it
|
👍 Beauty. Thanks @codeodor. |
|
Had same problem, updated gem, fixed it. Thanks. |
|
Looks like this patch will raise an exception for any model that does not "acts_as_paranoid", as they will not have a paranoia_column defined. I fixed this locally with:
|
|
I'm not sure, but I don't think so. I'm assuming that the rails 4 handles this in a different way, and so this bit of code became unnecessary? Sorry, I should have been more specific and mentioned that I'm looking at code from the Rails 3 branch, as that is what the project I'm working on is. |
|
I'd encourage a PR. I dunno if they plan to keep up any compatibility with Rails 3, but it definitely was a big oversight on my part in the original PR. |
|
Thanks, I'll see if I can find the time to put one together. |

For the rails3 branch, in pursuit of #114