Skip to content

Commit

Permalink
after db migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
vsakode committed Mar 25, 2013
1 parent 81db63a commit 46c2301
Show file tree
Hide file tree
Showing 18 changed files with 449 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/faillogs.js.coffee
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/faillogs.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the faillogs controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
69 changes: 69 additions & 0 deletions app/assets/stylesheets/scaffolds.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
83 changes: 83 additions & 0 deletions app/controllers/faillogs_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
class FaillogsController < ApplicationController
# GET /faillogs
# GET /faillogs.json
def index
@faillogs = Faillog.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @faillogs }
end
end

# GET /faillogs/1
# GET /faillogs/1.json
def show
@faillog = Faillog.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @faillog }
end
end

# GET /faillogs/new
# GET /faillogs/new.json
def new
@faillog = Faillog.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @faillog }
end
end

# GET /faillogs/1/edit
def edit
@faillog = Faillog.find(params[:id])
end

# POST /faillogs
# POST /faillogs.json
def create
@faillog = Faillog.new(params[:faillog])

respond_to do |format|
if @faillog.save
format.html { redirect_to @faillog, notice: 'Faillog was successfully created.' }
format.json { render json: @faillog, status: :created, location: @faillog }
else
format.html { render action: "new" }
format.json { render json: @faillog.errors, status: :unprocessable_entity }
end
end
end

# PUT /faillogs/1
# PUT /faillogs/1.json
def update
@faillog = Faillog.find(params[:id])

respond_to do |format|
if @faillog.update_attributes(params[:faillog])
format.html { redirect_to @faillog, notice: 'Faillog was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @faillog.errors, status: :unprocessable_entity }
end
end
end

# DELETE /faillogs/1
# DELETE /faillogs/1.json
def destroy
@faillog = Faillog.find(params[:id])
@faillog.destroy

respond_to do |format|
format.html { redirect_to faillogs_url }
format.json { head :no_content }
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/faillogs_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module FaillogsHelper
end
3 changes: 3 additions & 0 deletions app/models/faillog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Faillog < ActiveRecord::Base
attr_accessible :DateTime, :FailureCode, :FailureType, :FromAddress, :MailingId, :MessageId, :Reason, :ServerId, :ToAddress
end
53 changes: 53 additions & 0 deletions app/views/faillogs/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<%= form_for(@faillog) do |f| %>
<% if @faillog.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@faillog.errors.count, "error") %> prohibited this faillog from being saved:</h2>

<ul>
<% @faillog.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :ServerId %><br />
<%= f.number_field :ServerId %>
</div>
<div class="field">
<%= f.label :DateTime %><br />
<%= f.text_field :DateTime %>
</div>
<div class="field">
<%= f.label :MessageId %><br />
<%= f.text_field :MessageId %>
</div>
<div class="field">
<%= f.label :MailingId %><br />
<%= f.text_field :MailingId %>
</div>
<div class="field">
<%= f.label :ToAddress %><br />
<%= f.text_field :ToAddress %>
</div>
<div class="field">
<%= f.label :FromAddress %><br />
<%= f.text_field :FromAddress %>
</div>
<div class="field">
<%= f.label :FailureType %><br />
<%= f.number_field :FailureType %>
</div>
<div class="field">
<%= f.label :FailureCode %><br />
<%= f.number_field :FailureCode %>
</div>
<div class="field">
<%= f.label :Reason %><br />
<%= f.text_area :Reason %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
6 changes: 6 additions & 0 deletions app/views/faillogs/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h1>Editing faillog</h1>

<%= render 'form' %>
<%= link_to 'Show', @faillog %> |
<%= link_to 'Back', faillogs_path %>
39 changes: 39 additions & 0 deletions app/views/faillogs/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<h1>Listing faillogs</h1>

<table>
<tr>
<th>Serverid</th>
<th>Datetime</th>
<th>Messageid</th>
<th>Mailingid</th>
<th>Toaddress</th>
<th>Fromaddress</th>
<th>Failuretype</th>
<th>Failurecode</th>
<th>Reason</th>
<th></th>
<th></th>
<th></th>
</tr>

<% @faillogs.each do |faillog| %>
<tr>
<td><%= faillog.ServerId %></td>
<td><%= faillog.DateTime %></td>
<td><%= faillog.MessageId %></td>
<td><%= faillog.MailingId %></td>
<td><%= faillog.ToAddress %></td>
<td><%= faillog.FromAddress %></td>
<td><%= faillog.FailureType %></td>
<td><%= faillog.FailureCode %></td>
<td><%= faillog.Reason %></td>
<td><%= link_to 'Show', faillog %></td>
<td><%= link_to 'Edit', edit_faillog_path(faillog) %></td>
<td><%= link_to 'Destroy', faillog, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>

<br />

<%= link_to 'New Faillog', new_faillog_path %>
5 changes: 5 additions & 0 deletions app/views/faillogs/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>New faillog</h1>

<%= render 'form' %>
<%= link_to 'Back', faillogs_path %>
50 changes: 50 additions & 0 deletions app/views/faillogs/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<p id="notice"><%= notice %></p>

<p>
<b>Serverid:</b>
<%= @faillog.ServerId %>
</p>

<p>
<b>Datetime:</b>
<%= @faillog.DateTime %>
</p>

<p>
<b>Messageid:</b>
<%= @faillog.MessageId %>
</p>

<p>
<b>Mailingid:</b>
<%= @faillog.MailingId %>
</p>

<p>
<b>Toaddress:</b>
<%= @faillog.ToAddress %>
</p>

<p>
<b>Fromaddress:</b>
<%= @faillog.FromAddress %>
</p>

<p>
<b>Failuretype:</b>
<%= @faillog.FailureType %>
</p>

<p>
<b>Failurecode:</b>
<%= @faillog.FailureCode %>
</p>

<p>
<b>Reason:</b>
<%= @faillog.Reason %>
</p>


<%= link_to 'Edit', edit_faillog_path(@faillog) %> |
<%= link_to 'Back', faillogs_path %>
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Failog::Application.routes.draw do
resources :faillogs


# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
17 changes: 17 additions & 0 deletions db/migrate/20130325092057_create_faillogs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class CreateFaillogs < ActiveRecord::Migration
def change
create_table :faillogs do |t|
t.integer :ServerId
t.string :DateTime
t.string :MessageId
t.string :MailingId
t.string :ToAddress
t.string :FromAddress
t.integer :FailureType
t.integer :FailureCode
t.text :Reason

t.timestamps
end
end
end
30 changes: 30 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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 => 20130325092057) do

create_table "faillogs", :force => true do |t|
t.integer "ServerId"
t.string "DateTime"
t.string "MessageId"
t.string "MailingId"
t.string "ToAddress"
t.string "FromAddress"
t.integer "FailureType"
t.integer "FailureCode"
t.text "Reason"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

end
Loading

0 comments on commit 46c2301

Please sign in to comment.