M
M
Maksik2017-02-24 14:57:03
Ruby on Rails
Maksik, 2017-02-24 14:57:03

Do I need an admin panel for a Ruby on Rails content project?

Guys help advice. I want to understand the principle of building content projects. There is a site for example edimdoma.ru it is written in Ruby on Rails. In appearance, the site is beautiful and functional, but I can’t understand whether an admin panel (rails_admin, activeadmin) was created for it for posting, rights, etc., or with the help of special gems. Help to understand the principles of development of such a project.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Bordenyuk, 2017-02-24
@RailsRoger

It often happens that gems like activeadmin, administrate are not enough and you need to make the admin panel on your own, moving it, for example, to namespace

# routes.rb
namespace :admin do
  resources :articles
  resources :posts
end

Accordingly, routes will need to have a controller app/controllers/admin/articles_controller.rb
# admin/articles_controller.rb
class Admin::ArticlesController < Admin::BaseController
...
end

# admin/base_controller.rb
class Admin::BaseController < ApplicationController
  before_action :authenticate_admin!
  layout 'admin'

  protected
  def authenticate_admin!
    authenticate_user!
    redirect_to :root unless current_user.admin?
  end
end

Cool gems:
gem 'rails-i18n'
gem 'simple_form'
gem 'slim'
gem 'gretel'
gem 'kaminari'
gem 'cocoon'
gem 'pg_search'
gem 'mini_magick'
gem 'jquery-fileupload-rails'
gem 'counter_culture'
gem 'devise'
gem 'devise-i18n'
gem 'carrierwave'
gem 'carrierwave-i18n'
gem 'ranked-model'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question