added Statistic and DataPoint models
This commit is contained in:
parent
0dc0af015f
commit
ecb059b661
7 changed files with 70 additions and 1 deletions
6
app/models/data_point.rb
Normal file
6
app/models/data_point.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class DataPoint < ActiveRecord::Base
|
||||
attr_accessor :descriptor
|
||||
attr_accessor :value
|
||||
|
||||
belongs_to :statistic
|
||||
end
|
||||
5
app/models/statistc.rb
Normal file
5
app/models/statistc.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Statistc < ActiveRecord::Base
|
||||
attr_accessor :average
|
||||
|
||||
has_many :data_points, :class_name => 'DataPoint'
|
||||
end
|
||||
14
db/migrate/20110120181553_create_statistcs.rb
Normal file
14
db/migrate/20110120181553_create_statistcs.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class CreateStatistcs < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :statistcs do |t|
|
||||
t.integer :average
|
||||
t.string :type
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :statistcs
|
||||
end
|
||||
end
|
||||
17
db/migrate/20110120182100_create_data_points.rb
Normal file
17
db/migrate/20110120182100_create_data_points.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class CreateDataPoints < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :data_points do |t|
|
||||
t.string :descriptor
|
||||
t.integer :value
|
||||
t.integer :statistic_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :data_points, :statistic_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :data_points, :statistic_id
|
||||
drop_table :data_points
|
||||
end
|
||||
end
|
||||
19
db/schema.rb
19
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110119221746) do
|
||||
ActiveRecord::Schema.define(:version => 20110120182100) do
|
||||
|
||||
create_table "aspect_memberships", :force => true do |t|
|
||||
t.integer "aspect_id"
|
||||
|
|
@ -67,6 +67,16 @@ ActiveRecord::Schema.define(:version => 20110119221746) do
|
|||
add_index "contacts", ["user_id", "pending"], :name => "index_contacts_on_user_id_and_pending"
|
||||
add_index "contacts", ["user_id", "person_id"], :name => "index_contacts_on_user_id_and_person_id", :unique => true
|
||||
|
||||
create_table "data_points", :force => true do |t|
|
||||
t.string "descriptor"
|
||||
t.integer "value"
|
||||
t.integer "statistic_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "data_points", ["statistic_id"], :name => "index_data_points_on_statistic_id"
|
||||
|
||||
create_table "invitations", :force => true do |t|
|
||||
t.text "message"
|
||||
t.integer "sender_id"
|
||||
|
|
@ -407,6 +417,13 @@ ActiveRecord::Schema.define(:version => 20110119221746) do
|
|||
add_index "services", ["mongo_id"], :name => "index_services_on_mongo_id"
|
||||
add_index "services", ["user_id"], :name => "index_services_on_user_id"
|
||||
|
||||
create_table "statistcs", :force => true do |t|
|
||||
t.integer "average"
|
||||
t.string "type"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "username"
|
||||
t.text "serialized_private_key"
|
||||
|
|
|
|||
5
spec/models/data_point_spec.rb
Normal file
5
spec/models/data_point_spec.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe DataPoint do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/statistc_spec.rb
Normal file
5
spec/models/statistc_spec.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Statistc do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Loading…
Reference in a new issue