NoMethodError: undefined method `marshal_dump' for #<ActiveModel::Errors:0x0000000006fcbba0>

412 views Asked by At

We use below ruby and rails version -

Ruby 2.7.3 Rails 6.1.3.2

While creating a new user it throws the below error -

NoMethodError (undefined method `marshal_dump' for #ActiveModel::Errors:0x0000000006fcbba0 Did you mean? marshal_load):
app/controllers/user_controller.rb:33:in `create'

Below Create method defined in the controller -

def create

   @user = User.new(user_params)

   respond_to do |format|
   if @user.save
      format.html { redirect_to @user, notice: 'User successfully created.' }
      format.json { render :show, status: :created, location: @user }
   else
      format.html { render :new }
      format.json { render json: @user.errors, status: :unprocessable_entity }
   end
  end
 end
0

There are 0 answers