--- /dev/null
+class ThumbsController < ApplicationController
+ # GET /thumbs
+ # GET /thumbs.xml
+ def index
+ @thumbs = Thumb.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @thumbs }
+ end
+ end
+
+ # GET /thumbs/1
+ # GET /thumbs/1.xml
+ def show
+ @thumb = Thumb.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @thumb }
+ end
+ end
+
+ # GET /thumbs/new
+ # GET /thumbs/new.xml
+ def new
+ @thumb = Thumb.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @thumb }
+ end
+ end
+
+ # GET /thumbs/1/edit
+ def edit
+ @thumb = Thumb.find(params[:id])
+ end
+
+ # POST /thumbs
+ # POST /thumbs.xml
+ def create
+ @thumb = Thumb.new(params[:thumb])
+ @thumb.id = params[:thumb].delete(:id)
+
+ respond_to do |format|
+ if @thumb.save
+ flash[:notice] = 'Thumb was successfully created.'
+ format.html { redirect_to(@thumb) }
+ format.xml { render :xml => @thumb, :status => :created, :location => @thumb }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @thumb.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /thumbs/1
+ # PUT /thumbs/1.xml
+ def update
+ @thumb = Thumb.find(params[:id])
+
+ respond_to do |format|
+ if @thumb.update_attributes(params[:thumb])
+ flash[:notice] = 'Thumb was successfully updated.'
+ format.html { redirect_to(@thumb) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @thumb.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /thumbs/1
+ # DELETE /thumbs/1.xml
+ def destroy
+ @thumb = Thumb.find(params[:id])
+ @thumb.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(thumbs_url) }
+ format.xml { head :ok }
+ end
+ end
+end
--- /dev/null
+module ThumbsHelper
+end
--- /dev/null
+class Thumb < ActiveRecord::Base
+ set_primary_key :video_id
+end
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+ <title>Thumbs: <%= controller.action_name %></title>
+ <%= stylesheet_link_tag 'scaffold' %>
+</head>
+<body>
+
+<p style="color: green"><%= flash[:notice] %></p>
+
+<%= yield %>
+
+</body>
+</html>
--- /dev/null
+<h1>Editing thumb</h1>
+
+<% form_for(@thumb) do |f| %>
+ <%= f.error_messages %>
+
+ <p>
+ <%= f.label :video_id %><br />
+ <%= f.text_field :video_id %>
+ </p>
+ <p>
+ <%= f.label :title %><br />
+ <%= f.text_field :title %>
+ </p>
+ <p>
+ <%= f.label :description %><br />
+ <%= f.text_field :description %>
+ </p>
+ <p>
+ <%= f.submit 'Update' %>
+ </p>
+<% end %>
+
+<%= link_to 'Show', @thumb %> |
+<%= link_to 'Back', thumbs_path %>
\ No newline at end of file
--- /dev/null
+<h1>Listing thumbs</h1>
+
+<table>
+ <tr>
+ <th>Video</th>
+ <th>Title</th>
+ <th>Description</th>
+ </tr>
+
+<% @thumbs.each do |thumb| %>
+ <tr>
+ <td><%=h thumb.video_id %></td>
+ <td><%=h thumb.title %></td>
+ <td><%=h thumb.description %></td>
+ <td><%= link_to 'Show', thumb %></td>
+ <td><%= link_to 'Edit', edit_thumb_path(thumb) %></td>
+ <td><%= link_to 'Destroy', thumb, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New thumb', new_thumb_path %>
\ No newline at end of file
--- /dev/null
+<h1>New thumb</h1>
+
+<% form_for(@thumb) do |f| %>
+ <%= f.error_messages %>
+
+ <p>
+ <%= f.label :video_id %><br />
+ <%= f.text_field :video_id %>
+ </p>
+ <p>
+ <%= f.label :title %><br />
+ <%= f.text_field :title %>
+ </p>
+ <p>
+ <%= f.label :description %><br />
+ <%= f.text_field :description %>
+ </p>
+ <p>
+ <%= f.submit 'Create' %>
+ </p>
+<% end %>
+
+<%= link_to 'Back', thumbs_path %>
\ No newline at end of file
--- /dev/null
+<p>
+ <b>Video:</b>
+ <%=h @thumb.video_id %>
+</p>
+
+<p>
+ <b>Title:</b>
+ <%=h @thumb.title %>
+</p>
+
+<p>
+ <b>Description:</b>
+ <%=h @thumb.description %>
+</p>
+
+
+<%= link_to 'Edit', edit_thumb_path(@thumb) %> |
+<%= link_to 'Back', thumbs_path %>
\ No newline at end of file
ActionController::Routing::Routes.draw do |map|
+ map.resources :thumbs
+
map.resources :xes
map.resources :vmds
--- /dev/null
+class CreateThumbs < ActiveRecord::Migration
+ def self.up
+ create_table :thumbs, :id => false do |t|
+ t.string :video_id, :limit => 15, :null => false
+ t.string :title
+ t.text :description
+
+ t.timestamps
+ end
+ add_index :thumbs, [ :video_id ], :unique => true
+ end
+
+ def self.down
+ remove_index :thumbs, :column => [ :video_id ]
+ drop_table :thumbs
+ end
+end
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100608144944) do
+ActiveRecord::Schema.define(:version => 20100612234341) do
create_table "arcs", :force => true do |t|
t.string "code", :limit => 10, :null => false
t.datetime "updated_at"
end
+ create_table "thumbs", :id => false, :force => true do |t|
+ t.string "video_id", :limit => 15, :null => false
+ t.string "title"
+ t.text "description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "thumbs", ["video_id"], :name => "index_thumbs_on_video_id", :unique => true
+
create_table "vmds", :force => true do |t|
t.integer "arc_id"
t.string "path", :null => false
--- /dev/null
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ video_id: sm9
+ title: "新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師"
+ description: "レッツゴー!陰陽師(フルコーラスバージョン)"
--- /dev/null
+require 'test_helper'
+
+class ThumbsControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:thumbs)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create thumb" do
+ assert_difference('Thumb.count') do
+ post :create, :thumb => { :id => 'sm9996481', :title => '[MMD]Lat式ちびミクが更にちみっこになったので', :description => 'sm9983872 のあおぽん様とネタ被り記念。真逆、自分と同じ事を実行する人がいるとは思わなかったorz左から順にあおぽん様Lat式ちびミク、6666AAP様Lat式ちびミク、自作Lat式ちみっこミク、ちびミク、ぷちミクと並んでおります。音源データは、sm9201748モデルデータは sm7542126 / sm8620825 / sm9931954 / sm9983872 背景データは、sm8695572以上よりお借り致しました。ありがとうございます。改造データ:http://loda.jp/mikumikudance/?id=236' }
+ end
+
+ assert_redirected_to thumb_path(assigns(:thumb))
+ end
+
+ test "should show thumb" do
+ get :show, :id => thumbs(:one).to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, :id => thumbs(:one).to_param
+ assert_response :success
+ end
+
+ test "should update thumb" do
+ put :update, :id => thumbs(:one).to_param, :thumb => { }
+ assert_redirected_to thumb_path(assigns(:thumb))
+ end
+
+ test "should destroy thumb" do
+ assert_difference('Thumb.count', -1) do
+ delete :destroy, :id => thumbs(:one).to_param
+ end
+
+ assert_redirected_to thumbs_path
+ end
+end
--- /dev/null
+require 'test_helper'
+
+class ThumbsHelperTest < ActionView::TestCase
+end
--- /dev/null
+require 'test_helper'
+
+class ThumbTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end