users
This commit is contained in:
parent
46b74305bf
commit
44185e8552
10 changed files with 37 additions and 0 deletions
3
app/assets/javascripts/users.js.coffee
Normal file
3
app/assets/javascripts/users.js.coffee
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/stylesheets/users.css.scss
Normal file
3
app/assets/stylesheets/users.css.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Users controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
8
app/controllers/users_controller.rb
Normal file
8
app/controllers/users_controller.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class UsersController < ApplicationController
|
||||
def new
|
||||
end
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
end
|
2
app/helpers/users_helper.rb
Normal file
2
app/helpers/users_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module UsersHelper
|
||||
end
|
|
@ -1,2 +1,3 @@
|
|||
class User < ActiveRecord::Base
|
||||
validates :name, presence: true, length: { maximum: 50 }
|
||||
end
|
||||
|
|
2
app/views/users/new.html.erb
Normal file
2
app/views/users/new.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h1>Users#new</h1>
|
||||
<p>Find me in app/views/users/new.html.erb</p>
|
1
app/views/users/show.html.erb
Normal file
1
app/views/users/show.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= @user.name %>, <%= @user.marks %>
|
|
@ -1,5 +1,7 @@
|
|||
Rails.application.routes.draw do
|
||||
|
||||
get 'users/new'
|
||||
|
||||
get 'static_pages/order'
|
||||
|
||||
root 'static_pages#home'
|
||||
|
@ -7,6 +9,8 @@ Rails.application.routes.draw do
|
|||
get 'overview' => 'static_pages#overview'
|
||||
get 'static_pages/overview'
|
||||
|
||||
resources :users
|
||||
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
# See how all your routes lay out with "rake routes".
|
||||
|
||||
|
|
9
test/controllers/users_controller_test.rb
Normal file
9
test/controllers/users_controller_test.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UsersControllerTest < ActionController::TestCase
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
4
test/helpers/users_helper_test.rb
Normal file
4
test/helpers/users_helper_test.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UsersHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in a new issue