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

Rails 4.2: Unable to use obfuscate_id :spin => 89238723 #34

Open
ACPK opened this issue Feb 13, 2015 · 4 comments
Open

Rails 4.2: Unable to use obfuscate_id :spin => 89238723 #34

ACPK opened this issue Feb 13, 2015 · 4 comments

Comments

@ACPK
Copy link

ACPK commented Feb 13, 2015

#28

@ACPK ACPK changed the title Not support Rails 4.2 obfuscate_id :spin => 89238723 does not support Rails 4.2 Mar 18, 2015
@ACPK ACPK changed the title obfuscate_id :spin => 89238723 does not support Rails 4.2 Rails 4.2: Unable to use obfuscate_id :spin => 89238723 Mar 18, 2015
@ACPK
Copy link
Author

ACPK commented Apr 30, 2015

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'

@erikshestopal
Copy link

@ACPK Can you provide the full stacktrace?

@johanoskarsson
Copy link

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:infind'
/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)

@erikshestopal
Copy link

@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)

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

3 participants