NG DAVID

Joined

1,780 Experience
17 Lessons Completed
0 Questions Solved

Activity

Nice works

Posted in Two Factor Authentication With Devise Discussion

My issues is: it is easier to use SqlLite as development platform before posting the system.

Posted in Group Chat with ActionCable: Part 6 Discussion

That would be great. Look forward.

Posted in Group Chat with ActionCable: Part 6 Discussion

HI, I did the group chat on 5.2 and now I want to port it to a new rails 6 app in web pack. I got this error

teams.coffee:20 Uncaught ReferenceError: App is not defined

which is in teams.coffee line 20
App.teams.send_message(team_id, body.val())

where the file teams.coffee is app/Javascript/packs directory

any ideas ?

Posted in Two Factor Authentication With Devise Discussion

The Error is caused by the Sqllite database which does not support array. Once I change the database to postgresql, it is OK.

Thanks for feedback.

Posted in Two Factor Authentication With Devise Discussion

I got this error when I login with 2 factor authenication.

NoMethodError in Users::SessionsController#create
undefined method `each' for #String:0x000055ad15249060

    codes = self.otp_backup_codes || []
    codes.each do |backup_code|
      next unless Devise::Encryptor.compare(self.class, backup_code, code)
      codes.delete(backup_code)

The Error is strange to me.  There is no Create method in Users::SessionsController in your example code

Posted in Group Chat with ActionCable: Part 3 Discussion

Checking with the console, find the following error message. It appears the code does not work well with I18n multi-language support.

Failed to execute 'querySelector' on 'Document': '/?locale=en' is not a valid selector.

Ane one could help ?

Posted in Group Chat with ActionCable: Part 3 Discussion

I follow the instruction, the message are not saved to the database.

Your help is appreciated. My chatrooms.coffee is :

handleVisiblityChange = ->
$strike = $(".strike")
if $strike.length > 0
chatroom_id = $("[data-behavior='messages']").data("chatroom-id")
App.last_read.update(chatroom_id)
$strike.remove()

$(document).on "turbolinks:load", ->
$(document).on "click", handleVisiblityChange

$("#new_message").on "keypress", (e) ->
if e && e.keyCode == 13
e.preventDefault()
$(this).submit()

$("#new_message").on "submit", (e) ->
e.preventDefault()

chatroom_id = $("[data-behavior='messages']").data("chatroom-id")
body        = $("#message_body")

App.chatrooms.send_message(chatroom_id, body.val())

body.val("")