diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/users.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss new file mode 100644 index 0000000..31a2eac --- /dev/null +++ b/app/assets/stylesheets/users.css.scss @@ -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/ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..8dfd233 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,8 @@ +class UsersController < ApplicationController + def new + end + + def show + @user = User.find(params[:id]) + end +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/models/user.rb b/app/models/user.rb index 4a57cf0..d95d942 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,2 +1,3 @@ class User < ActiveRecord::Base + validates :name, presence: true, length: { maximum: 50 } end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..c21a1ad --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,2 @@ +
Find me in app/views/users/new.html.erb
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..aa2e444 --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1 @@ +<%= @user.name %>, <%= @user.marks %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3d56c63..6bce2c6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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". diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 0000000..7d2d9b1 --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + test "should get new" do + get :new + assert_response :success + end + +end diff --git a/test/helpers/users_helper_test.rb b/test/helpers/users_helper_test.rb new file mode 100644 index 0000000..96af37a --- /dev/null +++ b/test/helpers/users_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class UsersHelperTest < ActionView::TestCase +end