問題は四択で10問ずつ合計70問あります。各問題には解答がついていますが、はじめは閉じた状態でトライしてみてください。
10問毎に「終了/採点」ボタンをクリックすると採点ができます。次の10問へお進みください。繰り返しトライすることも可能です。
config/routes.rb 1: Rails3::Application.routes.draw do 2: resources :users 3: end
rake routes の結果 users GET /users(.:format) {:action=>"index", :controller=>"users"} POST /users(.:format) {:action=>"create", :controller=>"users"} new_user GET /users/new(.:format) {:action=>"new", :controller=>"users"} edit_user GET /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"} user GET /users/:id(.:format) {:action=>__(1)__, :controller=>"users"} __(2)__ /users/:id(.:format) {:action=>"update", :controller=>"users"} DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
app/controllers/users_controller.rb 1: class UsersController < ApplicationController 2: def new 3: @user = User.new 4: end 5: 6: def create 7: @user = __(1)__ 8: if @user.save 9: redirect_to @user 10: else 11: render :action => :new 12: end 13: end 14: end
app/views/users/new.html.erb 1: <%= form_for @user do |f| %> 2: <%= f.text_field :name %> 2: <%= f.text_field :email %> 3: <%= f.submit %> 4: <% end %>
1: class UsersController < ApplicationController 2: def show 3: @user = User.find(params[:id]) 4: respond_to do |format| 5: __(1)__ 6: end 7: end 8: end
1: Rails3::Application.routes.draw do 2: __(1)__ 3: end
1: <% s = '<a href="#">click</a>' %> 2: __(1)__
リスト1 1: class User < ActiveRecord::Base 2: end
リスト2 1: <%= render User.all %>
1: <%= form_for User.new do |f| %> 2: <%= __(1)__ %> 3: <% end %>
1: class NoticeMailer < ActionMailer::Base 2: def updated(recipient) 3: mail :to => recipient.email 4: end 5: end
リスト1 - users.yml 1: one: 2: name: John Doe 3: birthday: 1983-03-18 4: profession: Systems development
リスト2 - users_controller_test.rb 1: class UsersControllerTest < ActionController::TestCase 2: setup do 3: @user = __(1)__ 4: end 5: test "should get edit" do 6: get :edit, :id => @user.to_param 7: assert_response :success 8: end 9: end
show.html.erb 1: <h1><%= @user.name %></h1>