-
Notifications
You must be signed in to change notification settings - Fork 132
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
Updating model with update_attribute doesn't work #25
Comments
You never have to manually call Just make sure you include
Then just do this:
Feel free to reopen the issue if you are still having a problem. |
I was encountering this when using CarrierWave and uploading attachments. Not sure what the problem was but ended up doing a monkey patch and overriding |
@jurezove can you elaborate on what you did to work around your issue by using has_obfuscated_id? I am experiencing similar problems with trying to use obfuscate_id with carrierwave. No matter which method I use (find(obf_id) or find_by_id(orig_id)), carrierwave still has problems I had posted here a while back when at the time I believed it to be related to Resque, but it's also noted here quite some time ago but that fix referenced does not appear to work for this. |
Hey @scottbullard sorry for the late reply. In the end, I did a small hack:
Then for example, called that method:
Does something like this work for you? |
@jurezove thanks - I will give that a try. |
It looks like the id doesn't get deobfuscated before performing
update_attributes
.I'm using:
bill = Bill.find(Bill.deobfuscate_id(params[:id]))
bill.update_attributes(bill_params)
and I get
ActiveRecord::StatementInvalid: PG::NumericValueOutOfRange: ERROR: value "4903661204" is out of range for type integer
The text was updated successfully, but these errors were encountered: