Bill Tihen

Joined

290 Experience
2 Lessons Completed
0 Questions Solved

Activity

Posted in Eigenclasses Discussion

Ah - It looks like I have to wait a few days (I hope)

Posted in Eigenclasses Discussion

Why does this video say it is private - I have seen it on my iPhone, but its so small, I wanted to see it on a big screen too
Also - I would enjoy a video on Ruby's Hash caching and Rails Lowlevel Caching with blocks too - if that is interesting to you.

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
    from
    config.load_defaults 6.0
    to
    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:
    app/controllers/api/v1/user_token_controller.rb
    so the controller needs to look like:

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

AFTER these two fixes:
curl --data "auth[email]=user@email.com&auth[password]=*******" http://localhost:3000/api/v1/user_token
works!

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
  protected
  def after_sign_in_path_for(resource)
    # cofirm_email_sent_path
  end

Something like that - a lot like the recommendations for confirmable: https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users

so I looked at the controller for devise registrations:
https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb)

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