forked from fixin.me/fixin.me
Generate Units::Defaults controller
bin/rails g controller Units/Defaults index
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
class Units::DefaultsController < ApplicationController
|
||||||
|
before_action except: :index do
|
||||||
|
raise AccessForbidden unless current_user.at_least(:admin)
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
module Units::DefaultsHelper
|
||||||
|
end
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>Units::Defaults#index</h1>
|
||||||
|
<p>Find me in app/views/units/defaults/index.html.erb</p>
|
||||||
@@ -8,6 +8,10 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :units do
|
||||||
|
get 'defaults/index'
|
||||||
|
end
|
||||||
|
|
||||||
resources :users, only: [:index, :show, :update] do
|
resources :users, only: [:index, :show, :update] do
|
||||||
member do
|
member do
|
||||||
get :disguise
|
get :disguise
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class Units::DefaultsControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
test "should get index" do
|
||||||
|
get units_defaults_index_url
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user