Resourceful routing and admin namespace question

Hi all. I have a route file like this:

Deals::Application.routes.draw do
root to: “Main#home”

resources :vendors do
resources :offers

match ‘/admin’ => ‘Admin::Pages#index’

namespace :admin do
match ‘/login’, to: ‘Sessions#new’
resources :offers, :vendors
resources :sessions, only: [:new, :create, :destroy]

First of all I would like to know if the way I declared the namespace
the matching rules inside it are ok.

Next, I want the visitors of the app (front-end) to be able only to view
the :offers and :vendor resources (index & show actions). I only want to
allow admins ( which are the logged users, to be
to manage these resources (edit, add, delete etc). How could I implement

Should I do it like this? Or could I just
it as is and not implement the actions in the public controllers?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs