Skip to content

Commit

Permalink
DeviceSpecification models
Browse files Browse the repository at this point in the history
  • Loading branch information
Jia Wu committed Mar 16, 2012
1 parent b574981 commit 544cd71
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/models/device_specification.rb
@@ -0,0 +1,5 @@
module DeviceSpecification
def self.table_name_prefix
'device_specification_'
end
end
3 changes: 3 additions & 0 deletions app/models/device_specification/category.rb
@@ -0,0 +1,3 @@
class DeviceSpecification::Category < ActiveRecord::Base
has_many :properties
end
3 changes: 3 additions & 0 deletions app/models/device_specification/property.rb
@@ -0,0 +1,3 @@
class DeviceSpecification::Property < ActiveRecord::Base
belongs_to :category
end
7 changes: 7 additions & 0 deletions config/application.rb
Expand Up @@ -55,5 +55,12 @@ class Application < Rails::Application


# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' 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
end end
@@ -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
@@ -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
29 changes: 29 additions & 0 deletions 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
Empty file removed test/fixtures/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -7,7 +7,7 @@ class ActiveSupport::TestCase
# #
# Note: You'll currently still have to declare fixtures explicitly in integration tests # Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting # -- they do not yet inherit this setting
fixtures :all #fixtures :all


# Add more helper methods to be used by all tests here... # Add more helper methods to be used by all tests here...
end end

0 comments on commit 544cd71

Please sign in to comment.