"rails for beginners part 21"
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'
signed_id' for #User:0x00007fc2ad38d728)
NoMethodError (undefined method
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?
Make sure you're using the latest Rails version. I don't think this works in older Rails versions.
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?
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