Bill Tihen


270 Experience
2 Lessons Completed
0 Questions Solved


Posted in How to use Hotwire in Rails Discussion

I have to the best of my ability followed the code - but for some reason, the only two things that don't broadcast is the like and retweet updates. Can anyone else verify this is the case?

I will do that next - for better understanding indeed. I am mostly interested in the Devise JWT - since that is what I use most of the time anyway, but the series is interesting so I figured it can't hurt to debug a little.

Solution for Rails 6

  • To fix the autoloading problem on config and the error (uninitialized constant Knock) while trying to use
    change the line in: config/application.rb
    config.load_defaults 6.0
    config.load_defaults 6.0 and config.autoloader = :classic

  • To fix the problem Can't verify CSRF token authenticity.
    include skip_before_action :verify_authenticity_token in the file:
    so the controller needs to look like:

    class Api::V1::UserTokenController < Knock::AuthTokenController
    skip_before_action :verify_authenticity_token
    def entity_name

AFTER these two fixes:
curl --data "auth[email][password]=*******" http://localhost:3000/api/v1/user_token

Looks like knock has an eager_load problem with Rails 6 & knock is no longer being maintained.

Posted in Issue with devise

I am having the same error (with Devise within an engine) - can you say more about your solution?

I think I will try to override the method:

# app/config/routes.rb
# devise_for :users, :controllers => {:registrations => "registrations"}

# app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
  def after_sign_in_path_for(resource)
    # cofirm_email_sent_path

Something like that - a lot like the recommendations for confirmable:

so I looked at the controller for devise registrations:

Did you get an answer to this? I'm looking for the same information.

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.