Ask A Question

Notifications

Youโ€™re not receiving notifications from this thread.

"rails for beginners part 21"

gabriele garretto asked in Rails โ€ข

i cant make work user.signed_id, it raises a no_method_error:

irb(main):010:0> user.signed_id
Traceback (most recent call last):
2: from (irb):9
1: from (irb):10:in rescue in irb_binding'
NoMethodError (undefined method
signed_id' for #User:0x00007fc2ad38d728)

fiddling around i tryed user.to_signed_global_id:

irb(main):011:0> user.to_signed_global_id.to_s
=> "BAh7CEkiCGdpZAY6BkVUSSIaZ2lkOi8vZmlzaHJvb20vVXNlci84BjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVEkiHTIwMjEtMDMtMDlUMTU6Mzc6NDUuNzM3WgY7AFQ=--3d69db1dd78c21da26d108891727e32948b1d3f3"
irb(main):012:0> user.to_signed_global_id(expires_in:15.minutes)
=> #, @verifier=#, @purpose="default", @expires_at=Tue, 09 Feb 2021 15:54:00 UTC +00:00>
irb(main):013:0>

is this the same thing as signed_id? why in the video of chris this all thing does work?

Reply

Make sure you're using the latest Rails version. I don't think this works in older Rails versions.

Reply

thanks for the answer chris, i actually was running rails 6.0, since I'm implementing this course on an app that i was already building on 6.0, do you think i should upgrade it or i risk to brake something?

Reply

The Rails 6.0 to 6.1 is really simple, so you should be fine upgrading. ๐Ÿ‘

The update task is pretty easy: bin/rails app:update

And of course, all the details are here: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html

Reply

thank you very much, you'r the man!๐Ÿ™Œ

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.