Home > Blockchain >  Devise is not creating user
Devise is not creating user

Time:04-13

devise is not creating a new user.

I fill out the sign-up form for a new registration and then when I click on the validate button it redirects me to my sign-in form with this message:

"You need to sign in or sign up before continuing."

When I type User.last in the Rails console, it confirms that the user has not been created.

I can still connect by filling out the sign-in form with the information I have created in my seeds.

User model:

class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
  :recoverable, :rememberable, :validatable

  has_many :biens, dependent: :destroy
  has_one_attached :avatar


  def profile_picture
    if avatar.attached?
      avatar.key
    else
      "default_profile_pic_xl837y"
    end
  end
end

Routes.rb:

Rails.application.routes.draw do
  devise_for :users

  root to: 'pages#home'
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
  resources :biens do
    collection do
      get :userbiens
    end
  end
end

new.html.erb form:

  <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
    <%= f.error_notification %>
    <div >
      <%= f.input :avatar, as: :file, label: "Photo de profile" %>
      <%# <%= cl_image_upload_tag(:image_id) %>
      <%= f.input :surnom, as: :string, hint: "Conseil : le meme que sur Facebook            
  • Related