I would suggest removing the Admin model, as in your case, it looks more like a namespace than a model. Instead, I would create a namespace :admin in your routes.rb , for example:
namespace :admin do resources :posts end
This will cause all routes inside this block to have the w / Admin prefix. Thus, the URL for editing the message on the administrator side will be admin/posts/:id/edit .
Next, I would suggest making an AdminController from which all your admin controllers inherit. This way you can specify a new layout. Then you can create Admin::PostsController in app/controllers/admin/posts_controller.rb
application / controllers / admin_controller.rb
class AdminController < ApplicationController layout 'admin' end
application / controllers / admin / posts_controller.rb
class Admin::PostsController < AdminController def index
app / view / admin / posts / index.html.erb
Hello from the admin/posts view!
source share