Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DeviceSpecification models

  • Loading branch information...
commit 544cd7107594ac0173124bf0062d8375d86203d3 1 parent b574981
Jia Wu authored
View
5 app/models/device_specification.rb
@@ -0,0 +1,5 @@
+module DeviceSpecification
+ def self.table_name_prefix
+ 'device_specification_'
+ end
+end
View
3  app/models/device_specification/category.rb
@@ -0,0 +1,3 @@
+class DeviceSpecification::Category < ActiveRecord::Base
+ has_many :properties
+end
View
3  app/models/device_specification/property.rb
@@ -0,0 +1,3 @@
+class DeviceSpecification::Property < ActiveRecord::Base
+ belongs_to :category
+end
View
7 config/application.rb
@@ -55,5 +55,12 @@ class Application < Rails::Application
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
+
+ config.generators do |g|
+ g.orm :active_record
+ g.test_framework :test_unit, :fixture => false
+ g.helper false
+ g.assets false
+ end
end
end
View
8 db/migrate/20120316214736_create_device_specification_categories.rb
@@ -0,0 +1,8 @@
+class CreateDeviceSpecificationCategories < ActiveRecord::Migration
+ def change
+ create_table :device_specification_categories do |t|
+ t.string :name
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20120316215156_create_device_specification_properties.rb
@@ -0,0 +1,9 @@
+class CreateDeviceSpecificationProperties < ActiveRecord::Migration
+ def change
+ create_table :device_specification_properties do |t|
+ t.string :name
+ t.belongs_to :category
+ t.timestamps
+ end
+ end
+end
View
29 db/schema.rb
@@ -0,0 +1,29 @@
+# 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 => 20120316215156) do
+
+ create_table "device_specification_categories", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "device_specification_properties", :force => true do |t|
+ t.string "name"
+ t.integer "category_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
View
0  test/fixtures/.gitkeep
No changes.
View
2  test/test_helper.rb
@@ -7,7 +7,7 @@ class ActiveSupport::TestCase
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
- fixtures :all
+ #fixtures :all
# Add more helper methods to be used by all tests here...
end
Please sign in to comment.
Something went wrong with that request. Please try again.