Browse files

fertig

  • Loading branch information...
1 parent 3a5ed18 commit 047b41b8d981bd7f3b30ddf9c9a898b86b398b4a @OliverWeih committed Jul 3, 2011
View
83 app/controllers/dbroutes_controller.rb
@@ -0,0 +1,83 @@
+class DbroutesController < ApplicationController
+ # GET /dbroutes
+ # GET /dbroutes.xml
+ def index
+ @dbroutes = Dbroute.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @dbroutes }
+ end
+ end
+
+ # GET /dbroutes/1
+ # GET /dbroutes/1.xml
+ def show
+ @dbroute = Dbroute.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @dbroute }
+ end
+ end
+
+ # GET /dbroutes/new
+ # GET /dbroutes/new.xml
+ def new
+ @dbroute = Dbroute.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @dbroute }
+ end
+ end
+
+ # GET /dbroutes/1/edit
+ def edit
+ @dbroute = Dbroute.find(params[:id])
+ end
+
+ # POST /dbroutes
+ # POST /dbroutes.xml
+ def create
+ @dbroute = Dbroute.new(params[:dbroute])
+
+ respond_to do |format|
+ if @dbroute.save
+ format.html { redirect_to(@dbroute, :notice => 'Dbroute was successfully created.') }
+ format.xml { render :xml => @dbroute, :status => :created, :location => @dbroute }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @dbroute.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /dbroutes/1
+ # PUT /dbroutes/1.xml
+ def update
+ @dbroute = Dbroute.find(params[:id])
+
+ respond_to do |format|
+ if @dbroute.update_attributes(params[:dbroute])
+ format.html { redirect_to(@dbroute, :notice => 'Dbroute was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @dbroute.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /dbroutes/1
+ # DELETE /dbroutes/1.xml
+ def destroy
+ @dbroute = Dbroute.find(params[:id])
+ @dbroute.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(dbroutes_url) }
+ format.xml { head :ok }
+ end
+ end
+end
View
2 app/helpers/dbroutes_helper.rb
@@ -0,0 +1,2 @@
+module DbroutesHelper
+end
View
2 app/models/dbroute.rb
@@ -0,0 +1,2 @@
+class Dbroute < ActiveRecord::Base
+end
View
29 app/views/dbroutes/_form.html.erb
@@ -0,0 +1,29 @@
+<%= form_for(@dbroute) do |f| %>
+ <% if @dbroute.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@dbroute.errors.count, "error") %> prohibited this dbroute from being saved:</h2>
+
+ <ul>
+ <% @dbroute.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :start %><br />
+ <%= f.text_field :start %>
+ </div>
+ <div class="field">
+ <%= f.label :ziel %><br />
+ <%= f.text_field :ziel %>
+ </div>
+ <div class="field">
+ <%= f.label :strecke %><br />
+ <%= f.text_field :strecke %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
6 app/views/dbroutes/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing dbroute</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @dbroute %> |
+<%= link_to 'Back', dbroutes_path %>
View
27 app/views/dbroutes/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing dbroutes</h1>
+
+<table>
+ <tr>
+ <th>Start</th>
+ <th>Ziel</th>
+ <th>Strecke</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @dbroutes.each do |dbroute| %>
+ <tr>
+ <td><%= dbroute.start %></td>
+ <td><%= dbroute.ziel %></td>
+ <td><%= dbroute.strecke %></td>
+ <td><%= link_to 'Show', dbroute %></td>
+ <td><%= link_to 'Edit', edit_dbroute_path(dbroute) %></td>
+ <td><%= link_to 'Destroy', dbroute, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Dbroute', new_dbroute_path %>
View
5 app/views/dbroutes/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New dbroute</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', dbroutes_path %>
View
20 app/views/dbroutes/show.html.erb
@@ -0,0 +1,20 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Start:</b>
+ <%= @dbroute.start %>
+</p>
+
+<p>
+ <b>Ziel:</b>
+ <%= @dbroute.ziel %>
+</p>
+
+<p>
+ <b>Strecke:</b>
+ <%= @dbroute.strecke %>
+</p>
+
+
+<%= link_to 'Edit', edit_dbroute_path(@dbroute) %> |
+<%= link_to 'Back', dbroutes_path %>
View
2 config/routes.rb
@@ -1,4 +1,6 @@
Route::Application.routes.draw do
+ resources :dbroutes
+
# The priority is based upon order of creation:
# first created -> highest priority.
View
15 db/migrate/20110703173008_create_dbroutes.rb
@@ -0,0 +1,15 @@
+class CreateDbroutes < ActiveRecord::Migration
+ def self.up
+ create_table :dbroutes do |t|
+ t.string :start
+ t.string :ziel
+ t.integer :strecke
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :dbroutes
+ end
+end
View
23 db/schema.rb
@@ -0,0 +1,23 @@
+# 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 => 20110703173008) do
+
+ create_table "dbroutes", :force => true do |t|
+ t.string "start"
+ t.string "ziel"
+ t.integer "strecke"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
View
56 public/stylesheets/scaffold.css
@@ -0,0 +1,56 @@
+body { background-color: #fff; color: #333; }
+
+body, 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; }
+a:visited { color: #666; }
+a:hover { color: #fff; background-color:#000; }
+
+div.field, div.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;
+}
+
+#error_explanation 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;
+}
+
+#error_explanation ul li {
+ font-size: 12px;
+ list-style: square;
+}
View
11 test/fixtures/dbroutes.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ start: MyString
+ ziel: MyString
+ strecke: 1
+
+two:
+ start: MyString
+ ziel: MyString
+ strecke: 1
View
49 test/functional/dbroutes_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class DbroutesControllerTest < ActionController::TestCase
+ setup do
+ @dbroute = dbroutes(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:dbroutes)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create dbroute" do
+ assert_difference('Dbroute.count') do
+ post :create, :dbroute => @dbroute.attributes
+ end
+
+ assert_redirected_to dbroute_path(assigns(:dbroute))
+ end
+
+ test "should show dbroute" do
+ get :show, :id => @dbroute.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, :id => @dbroute.to_param
+ assert_response :success
+ end
+
+ test "should update dbroute" do
+ put :update, :id => @dbroute.to_param, :dbroute => @dbroute.attributes
+ assert_redirected_to dbroute_path(assigns(:dbroute))
+ end
+
+ test "should destroy dbroute" do
+ assert_difference('Dbroute.count', -1) do
+ delete :destroy, :id => @dbroute.to_param
+ end
+
+ assert_redirected_to dbroutes_path
+ end
+end
View
8 test/unit/dbroute_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class DbrouteTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
View
4 test/unit/helpers/dbroutes_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class DbroutesHelperTest < ActionView::TestCase
+end

0 comments on commit 047b41b

Please sign in to comment.