# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: learning_results
#
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#
-# label :
-# unit :
+# unit_id :
# level :integer
# amount :integer
# lock_version :integer
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: problems
#
# id :integer not null, primary key
+# unit_id :integer not null
# problem_group_problem_id :integer
-# label :string(255) not null
-# unit :string(255) not null, index_problems_on_unit_and_level(unique)
-# level :integer not null, index_problems_on_unit_and_level(unique)
-# amount :integer not null
+# level :integer default(0), not null
+# amount :integer default(1), not null
# options :text not null
# lock_version :integer default(0), not null
# created_at :datetime
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: problem_groups
#
class ProblemGroup < ActiveRecord::Base
has_many :problem_groups_problems, :class_name => 'ProblemGroupsProblems', :dependent => :destroy
- has_many :problems, :through => :problem_groups_problems
+ has_many :problems, :through => :problem_groups_problems, :order => 'unit_id, level ASC'
has_many :learning_results
has_many :reports
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: problem_groups_problems
#
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: reports
#
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: roles
#
+# == Schema Information
+# Schema version: 20100224042103
+#
+# Table name: units
+#
+# id :integer not null, primary key
+# name :string(40) not null
+# symbol :string(40) not null, index_units_on_symbol
+# form_class_name :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
class Unit < ActiveRecord::Base
has_many :problmes
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: users
#
# == Schema Information
-# Schema version: 20100210063013
+# Schema version: 20100224042103
#
# Table name: active_forms
#