namespaceを使ったURLを作る
管理者ページだとかには以下の様に"admin"階層がある。
この階層の作成方法のメモ。
rvmのgemsetを作成する
$rvm use 1.9.3-p194@rails3.2 --create
アプリ作成
$rails new admin_test
$cd admin_test/
ルーティング編集
namespace :admin do resources :posts , only: :index end
app/controllers/admin/posts_controller.rb
class Admin::PostsController < ApplicationController def index end end
一行目がミソ。
app/views/admin/posts/index.html.erb作成
中身適当