André Yuhai

Joined

5,160 Experience
50 Lessons Completed
0 Questions Solved

Activity

That's an excellent question! I had never thought about it and that made me wonder as well. So I've tried that with the app I'd created by watching this tutorial.

Basically if you schedule a Tweet Job and then delete the Tweet then you basically get an error saying

2021-03-21T18:26:02.805921+00:00 app[worker.1]: pid=4 tid=f60 WARN: ActiveJob::DeserializationError: Error while trying to deserialize arguments: Couldn't find Tweet with 'id'=4

That means the job is still being executed but since the Tweet is deleted you get an error.
Below you can find the details about the job when I check the Sidekiq::RetrySet.

=> #<Sidekiq::SortedEntry:0x0000564c2ef9d410 @args=nil, @value="{\"retry\":true,\"queue\":\"default\",\"class\":\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\",\"wrapped\":\"TweetJob\",\"args\":[{\"job_class\":\"TweetJob\",\"job_id\":\"57111c77-cc0f-42d1-b64d-e9834b6ad3dc\",\"provider_job_id\":null,\"queue_name\":\"default\",\"priority\":null,\"arguments\":[{\"_aj_globalid\":\"gid://scheduled-tweets/Tweet/4\"}],\"executions\":0,\"exception_executions\":{},\"locale\":\"en\",\"timezone\":\"UTC\",\"enqueued_at\":\"2021-03-21T18:25:04Z\"}],\"jid\":\"e2c13d0784ef40334478e95c\",\"created_at\":1616351104.086762,\"enqueued_at\":1616351294.922475,\"error_message\":\"Error while trying to deserialize arguments: Couldn't find Tweet with 'id'=4\",\"error_class\":\"ActiveJob::DeserializationError\",\"failed_at\":1616351162.804378,\"retry_count\":3,\"retried_at\":1616351294.929358}", @item={"retry"=>true, "queue"=>"default", "class"=>"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper", "wrapped"=>"TweetJob", "args"=>[{"job_class"=>"TweetJob", "job_id"=>"57111c77-cc0f-42d1-b64d-e9834b6ad3dc", "provider_job_id"=>nil, "queue_name"=>"default", "priority"=>nil, "arguments"=>[{"_aj_globalid"=>"gid://scheduled-tweets/Tweet/4"}], "executions"=>0, "exception_executions"=>{}, "locale"=>"en", "timezone"=>"UTC", "enqueued_at"=>"2021-03-21T18:25:04Z"}], "jid"=>"e2c13d0784ef40334478e95c", "created_at"=>1616351104.086762, "enqueued_at"=>1616351294.922475, "error_message"=>"Error while trying to deserialize arguments: Couldn't find Tweet with 'id'=4", "error_class"=>"ActiveJob::DeserializationError", "failed_at"=>1616351162.804378, "retry_count"=>3, "retried_at"=>1616351294.929358}, @queue="default", @score=1616351458.9293838, @parent=#<Sidekiq::RetrySet:0x0000564c2ef7a4d8 @name="retry", @_size=1>>

Posted in Rails & Vue.js Trello Clone - Part 3 Discussion

Thank you so much! I was wondering why drag & drop was not working properly. I mean when you drag & drop the list was moving back to its original place.

Also it says that,

options props has been deprecated in version v2.20.

So now we would use

<draggable :list="lists" group="lists" class="row dragArea" @end="listMoved">

I think.

Posted in Rails & Vue.js Trello Clone - Part 1 Discussion

Well, if anyone is watching this video now. Use the jumpstart template instead of trying to set the whole thing up from scratch because that might take a lot of time if you are a beginner like me.

Jumpstart: https://github.com/excid3/jumpstart

Posted in Rails for Beginners Part 41: Next Steps Discussion

Do you have any logs?

If you newly installed postgresql like me and you have no idea how to create your own user or especially if you are getting "Insufficient priviliges" error after creating your user. Then,

First use postgres user to connect to postgresql.

$ sudo -u postgres psql

Create a role with CREATE DB and LOGIN attributes

postgres=# create role <USERNAME> login createdb;

And then create a database that has the same name as the username you've used above.

postgres=# create database <USERNAME>;

When you re-schedule a Tweet, the existing Tweet is being updated. You do not create another Tweet in your DB when you re-schedule. So there will be only one Tweet in your database. Since there will only be one Tweet you can not check depending on publish_at.

Posted in Rails for Beginners Part 33: Twitter API Discussion

@David, check whether there's a comma at the end of
Rails.application.credentials.dig(:twitter, :api_key)
and
Rails.application.credentials.dig(:twitter, :api_secret)

I had the commas at the end, because of copy paste so I was getting Unauthorized error.

Posted in Rails for Beginners Part 31: Tweet Partial Discussion

I was curious as well and asked it on IRC, here you go: https://freenode.irclog.whitequark.org/ruby/2021-02-26#29240293;

I think that looks good, what I would suggest is auth_twitter_account instead of connect_twitter_account.

How do we invalidate a token once it's used? For example you can still use the same token even after you've already reset your password once. That would be nice to implement but not sure whether it's supported. Couldn't find anything about invalidating a token manually on their GitHub page.

Posted in Rails for Beginners Part 19: Edit Password Discussion

By the way, what's the reason that you've created a bang method called require_user_signed_in!. I know the general idea behind bang methods but how does that apply here? Why not just require_user_signed_in?

Posted in Rails for Beginners Part 19: Edit Password Discussion

Nice catch! That was really interesting to learn & try.

I would also like to learn about the inner workings of that session. For example how is that user_id attached to the session cookie? When we do session.inspect we can see everything as a hash but then how are they forged together, if they are at all?

AFAIK, that's because you need to pass an instance of a class not the class. So that, the form will fill out the missing parts of that specific instance upon submission of the form and save into the DB.

Posted in Rails for Beginners Part 12: Validations Discussion

I think you might be doing something wrong. It works in my case, https://rubular.com/r/SrvWLLOAMEq27C

The folder name does not have to be shared, it can be anything you wish. You can try foobar/_navbar.html.erb

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.