Asciicast model

openid
Marcin Kulik 13 years ago
parent b1eb7a30b8
commit c5de80788a

@ -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://jashkenas.github.com/coffee-script/

@ -0,0 +1,3 @@
// Place all the styles related to the Asciicasts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@ -0,0 +1,7 @@
class AsciicastsController < ApplicationController
def index
@asciicast = Asciicast.find(params[:id])
end
end

@ -0,0 +1,2 @@
module AsciicastsHelper
end

@ -0,0 +1,3 @@
class Asciicast < ActiveRecord::Base
validates :terminal_columns, :terminal_lines, :duration, :presence => true
end

@ -1,4 +1,6 @@
AsciiIo::Application.routes.draw do
resources :asciicasts
# The priority is based upon order of creation:
# first created -> highest priority.
@ -48,7 +50,7 @@ AsciiIo::Application.routes.draw do
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
root :to => 'asciicasts#index'
# See how all your routes lay out with "rake routes"

@ -0,0 +1,22 @@
class CreateAsciicasts < ActiveRecord::Migration
def change
create_table :asciicasts do |t|
t.integer :user_id
t.string :title
t.integer :duration, :null => false
t.datetime :recorded_at
t.string :terminal_type
t.integer :terminal_columns, :null => false
t.integer :terminal_lines, :null => false
t.string :command
t.string :shell
t.string :uname
t.timestamps
end
add_index :asciicasts, :user_id
add_index :asciicasts, :created_at
add_index :asciicasts, :recorded_at
end
end

@ -0,0 +1,35 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111123210607) do
create_table "asciicasts", :force => true do |t|
t.integer "user_id"
t.string "title"
t.integer "duration", :null => false
t.datetime "recorded_at"
t.string "terminal_type"
t.integer "terminal_columns", :null => false
t.integer "terminal_lines", :null => false
t.string "command"
t.string "shell"
t.string "uname"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "asciicasts", ["created_at"], :name => "index_asciicasts_on_created_at"
add_index "asciicasts", ["recorded_at"], :name => "index_asciicasts_on_recorded_at"
add_index "asciicasts", ["user_id"], :name => "index_asciicasts_on_user_id"
end

@ -0,0 +1,5 @@
require 'spec_helper'
describe AsciicastsController do
end

@ -0,0 +1,16 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :asciicast do
user_id 1
title "MyString"
duration 1
recorded_at "2011-11-23 22:06:07"
terminal_type "MyString"
terminal_columns 1
terminal_lines 1
command "MyString"
shell "MyString"
uname "MyString"
end
end

@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the AsciicastsHelper. For example:
#
# describe AsciicastsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe AsciicastsHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'spec_helper'
describe Asciicast do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save