obfuscate_id
obfuscate_id copied to clipboard
Rails 4.2: Unable to use obfuscate_id :spin => 89238723
https://github.com/namick/obfuscate_id/issues/28
Any luck getting this gem to work with Rails 4.2?
Here's the error you get when using Rails 4.2 and devise:
Couldn't find User with an out of range value for 'id'
@ACPK Can you provide the full stacktrace?
Here's the stacktrace I get:
Couldn't find User with an out of range value for 'id'
/usr/local/lib/ruby/gems/2.2.0/gems/activerecord-4.2.2/lib/active_record/core.rb:159:in rescue in find' /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-4.2.2/lib/active_record/core.rb:128:in
find'
/usr/local/lib/ruby/gems/2.2.0/gems/obfuscate_id-0.2.0/lib/obfuscate_id.rb:31:in `find'
By calling User.find(user_id)
@johanoskarsson The reason why you're getting this is because Rails is trying to lookup the record with the id you provided in the URL params, and no record with that id exists. Try this:
User.find_by(user_id])
or
User.find_by(params[:id)