Good day! Please tell us how to implement the admin panel on Ruby on Rails? If on PHP frameworks this is usually a new application, then how are things going with this? Thank!

  • In general, no different from writing the main part of the site. - Niki-Timofe
  • I understand this, but how to actually organize the admin itself? Create another application and place it in another folder? This moment is not clear - Vyacheslav Alexeev
  • @Vyacheslav_Alexeev, why is it so difficult, why not just create admin_controller and not cram the necessary actions into it?, Almost about MVC - Niki-Timofe

3 answers 3

No, you do not need to create a separate application. You can make the admin panel in the engine if you plan to connect it and use it on several sites. Somehow like this:

Controllers: app / controllers / admin / application_controller.rb

class Admin::ApplicationController < ActionController::Base http_basic_authenticate_with name: "admin", password: "secret" layout "admin/application" end 

app / controllers / admin / movies_controller.rb

 class Admin::MoviesController < Admin::ApplicationController # crud end 

Routes:

 # admin area get "/admin" => "admin/movies#index" namespace :admin do resources :movies end 

Views:

  • app / views / admin / movies /
  • app / views / admin / layouts / application.html.erb

    For this you can use a special heme

      Pro engine you have already answered.

      Of the ready-made solutions, I like ActiveAdmin the most. Reils admin is also very popular.

      A sample list can be found: Here