forked from fixin.me/fixin.me
Generate Units::Defaults controller
bin/rails g controller Units/Defaults index
This commit is contained in:
parent
b4212298df
commit
965cb76f1d
8
app/controllers/units/defaults_controller.rb
Normal file
8
app/controllers/units/defaults_controller.rb
Normal file
@ -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
|
2
app/helpers/units/defaults_helper.rb
Normal file
2
app/helpers/units/defaults_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module Units::DefaultsHelper
|
||||
end
|
2
app/views/units/defaults/index.html.erb
Normal file
2
app/views/units/defaults/index.html.erb
Normal file
@ -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
|
||||
|
||||
namespace :units do
|
||||
get 'defaults/index'
|
||||
end
|
||||
|
||||
resources :users, only: [:index, :show, :update] do
|
||||
member do
|
||||
get :disguise
|
||||
|
8
test/controllers/units/defaults_controller_test.rb
Normal file
8
test/controllers/units/defaults_controller_test.rb
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user