Q:

Multiple routes in same controller for post and destroy action? 

I'm confused with routes, I am working on json data, admin/admins_controller.rb
Getting Routing Error No route matches [POST] "/admin/adminsignup"*
admin/admins_controller.rb
class Admin::AdminsController < ApplicationController
  skip_before_action :verify_authenticity_token

  def adminlogin
    user = User.where(email: params[:email]).first
    if user&.valid_password?(params[:password]) 
      render json: user.as_json(only: :email,:first_name,:last_name,:phone,:authentication_token]), status: :created
    else
      head(:unauthorized)
    end
  end

  def adminsignup
    user = User.new(user_params)
    if user.save
      render json: {status: 'success', data:user}, status: :ok
    else
      render json: {status: 'error', message:'There was some error in registering the user.',  data:user.errors}, status: :unprocessable_entity
    end
  end

  def logindestroy
    current_user&.authentication_token = nil
      if current_user.save
         head(:ok)
      else
         head(:unauthorized)
      end
  end   

  private

  def user_params
    params.permit(:first_name, :last_name, :email, :password, :phone)
  end
end 

routes.rb
 namespace :admin do
   post 'admins', to: 'admins#adminlogin'
   post 'admins', to: 'admins#adminsignup'
   destroy 'admins', to: 'admins#logindestroy'
 end

user.rb
class User < ApplicationRecord
  acts_as_token_authenticatable

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

How can I use different controllers for devise login, naming like admins_controller & users_controller? 

Is is better way to do so?  Please help. 

A:

What you want to achieve, can be done by implementation provided here
Edit your routes as per your controller defined.