All threads / Invalid auth error
Ask A Question


You’re not receiving notifications from this thread.

Invalid auth error

Mpumelelo asked in General

ActionController::InvalidAuthenticityToken in MessagesController#create
please help me on this error.

I was following from part 1 until part 4 on group chat

Can you share the snippet of the code which is calling MessageController?

Thanks for replying Bilal. What is your username, full name or email address on Github so can add you to my repo

class MessagesController < ApplicationController
before_action :authenticate_user!
before_action :set_chatroom

def create
message =
message.user = current_user


def set_chatroom
  @chatroom = Chatroom.find(params[:chatroom_id])

def message_params


Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 70,078+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    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

    © 2023 GoRails, LLC. All rights reserved.