Permalink
Browse files

Silly models

  • Loading branch information...
1 parent 4811fc1 commit b363ec94985a05f3eaaba2dfa87fc6e4ce57794e @NZKoz committed Aug 8, 2008
@@ -0,0 +1,2 @@
+class GreetingsController < ApplicationController
+end
@@ -0,0 +1,2 @@
+module GreetingsHelper
+end
View
@@ -0,0 +1,3 @@
+class Greeting < ActiveRecord::Base
+ has_many :recipients
+end
View
@@ -0,0 +1,3 @@
+class Recipient < ActiveRecord::Base
+ belongs_to :greeting
+end
View
@@ -18,7 +18,7 @@
# Skip frameworks you're not going to use. To use Rails without a database
# you must remove the Active Record framework.
- config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
+ config.frameworks -= [ :active_resource, :action_mailer ]
# Specify gems that this application depends on.
# They can then be installed with "rake gems:install" on new installations.
View
@@ -1,41 +1,7 @@
ActionController::Routing::Routes.draw do |map|
- # The priority is based upon order of creation: first created -> highest priority.
- # Sample of regular route:
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
- # Keep in mind you can assign values other than :controller and :action
+ map.resources :greetings
- # Sample of named route:
- # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
- # This route can be invoked with purchase_url(:id => product.id)
-
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # map.resources :products
-
- # Sample resource route with options:
- # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
-
- # Sample resource route with sub-resources:
- # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
-
- # Sample resource route with more complex sub-resources
- # map.resources :products do |products|
- # products.resources :comments
- # products.resources :sales, :collection => { :recent => :get }
- # end
-
- # Sample resource route within a namespace:
- # map.namespace :admin do |admin|
- # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
- # admin.resources :products
- # end
-
- # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
- # map.root :controller => "welcome"
-
- # See how all your routes lay out with "rake routes"
-
- # Install the default routes as the lowest priority.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
@@ -0,0 +1,13 @@
+class CreateGreetings < ActiveRecord::Migration
+ def self.up
+ create_table :greetings do |t|
+ t.string :comment
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :greetings
+ end
+end
@@ -0,0 +1,14 @@
+class CreateRecipients < ActiveRecord::Migration
+ def self.up
+ create_table :recipients do |t|
+ t.string :name
+ t.belongs_to :greeting
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :recipients
+ end
+end
View
@@ -0,0 +1,27 @@
+# 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 => 20080808141911) do
+
+ create_table "greetings", :force => true do |t|
+ t.string "comment"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "recipients", :force => true do |t|
+ t.string "name"
+ t.integer "greeting_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ comment: MyString
+
+two:
+ comment: MyString
@@ -0,0 +1,9 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ name: MyString
+ greeting_id: 1
+
+two:
+ name: MyString
+ greeting_id: 1
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class GreetingsControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class GreetingTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class RecipientTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end

0 comments on commit b363ec9

Please sign in to comment.