aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-04 20:19:00 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-05 20:13:58 +0200
commit079178d191b149130f0558b5f88eab27b837c6b0 (patch)
tree6513bbd93425033ada23e99364972e1543dcfcd7
parentRun tests in prepared environment, don't load config. (diff)
downloadrecruiting-webapp-079178d191b149130f0558b5f88eab27b837c6b0.tar.gz
recruiting-webapp-079178d191b149130f0558b5f88eab27b837c6b0.tar.bz2
recruiting-webapp-079178d191b149130f0558b5f88eab27b837c6b0.zip
Add :null => false to required fields and relations in models.
-rw-r--r--app/models/answer.rb4
-rw-r--r--app/models/comment.rb4
-rw-r--r--app/models/option.rb4
-rw-r--r--app/models/project_acceptance.rb4
-rw-r--r--app/models/question_category.rb2
-rw-r--r--app/models/question_content_email.rb4
-rw-r--r--app/models/question_content_multiple_choice.rb2
-rw-r--r--app/models/question_content_text.rb2
-rw-r--r--app/models/user_category.rb4
-rw-r--r--app/models/user_question_group.rb4
-rw-r--r--db/schema.rb36
11 files changed, 35 insertions, 35 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb
index bde4deb..f8ab11f 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -5,7 +5,7 @@ class Answer < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- content HoboFields::MarkdownString
+ content HoboFields::MarkdownString, :null => false
approved :boolean, :default => false
reference :boolean, :default => false
feedback HoboFields::EnumString.for('', 'Documentation ok',
@@ -15,7 +15,7 @@ class Answer < ActiveRecord::Base
end
attr_readonly :reference
- belongs_to :question
+ belongs_to :question, :null => false
has_many :comments
named_scope :of_mentored_by, lambda { |mentor| {
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 53db93b..a67e7dc 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -3,11 +3,11 @@ class Comment < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- content HoboFields::MarkdownString
+ content HoboFields::MarkdownString, :null => false
timestamps
end
- belongs_to :answer
+ belongs_to :answer, :null => false
validates_presence_of :content
diff --git a/app/models/option.rb b/app/models/option.rb
index fe391a4..63a1ac8 100644
--- a/app/models/option.rb
+++ b/app/models/option.rb
@@ -3,11 +3,11 @@ class Option < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- content :string
+ content :string, :null => false
timestamps
end
- belongs_to :option_owner, :polymorphic => true, :creator => true
+ belongs_to :option_owner, :polymorphic => true, :creator => true, :null => false
never_show :option_owner_type
inherit_permissions(:option_owner)
diff --git a/app/models/project_acceptance.rb b/app/models/project_acceptance.rb
index 2bdba30..1bd76e2 100644
--- a/app/models/project_acceptance.rb
+++ b/app/models/project_acceptance.rb
@@ -4,12 +4,12 @@ class ProjectAcceptance < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- accepting_nick :string, :null => false
+ accepting_nick :string, :null => false, :null => false
accepted :boolean, :default => false
timestamps
end
- belongs_to :user
+ belongs_to :user, :null => false
attr_readonly :user
validates_presence_of :user, :accepting_nick
diff --git a/app/models/question_category.rb b/app/models/question_category.rb
index abda45a..bcf2db7 100644
--- a/app/models/question_category.rb
+++ b/app/models/question_category.rb
@@ -3,7 +3,7 @@ class QuestionCategory < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- name :string
+ name :string, :null => false
timestamps
end
diff --git a/app/models/question_content_email.rb b/app/models/question_content_email.rb
index 937ea15..7afc2d2 100644
--- a/app/models/question_content_email.rb
+++ b/app/models/question_content_email.rb
@@ -4,12 +4,12 @@ class QuestionContentEmail < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- requirements :text, :nil => false, :default => ""
+ requirements :text, :null => false, :default => ""
description HoboFields::MarkdownString
timestamps
end
- belongs_to :question
+ belongs_to :question, :null => false
attr_readonly :question
never_show :requirements
diff --git a/app/models/question_content_multiple_choice.rb b/app/models/question_content_multiple_choice.rb
index f1b3298..f721d2f 100644
--- a/app/models/question_content_multiple_choice.rb
+++ b/app/models/question_content_multiple_choice.rb
@@ -8,7 +8,7 @@ class QuestionContentMultipleChoice < ActiveRecord::Base
timestamps
end
- belongs_to :question
+ belongs_to :question, :null => false
attr_readonly :question
has_many :options, :as => :option_owner, :accessible => true, :uniq => true
validates_length_of :content, :minimum => 2
diff --git a/app/models/question_content_text.rb b/app/models/question_content_text.rb
index 4ce78c1..988f890 100644
--- a/app/models/question_content_text.rb
+++ b/app/models/question_content_text.rb
@@ -8,7 +8,7 @@ class QuestionContentText < ActiveRecord::Base
timestamps
end
- belongs_to :question
+ belongs_to :question, :null => false
attr_readonly :question
validates_length_of :content, :minimum => 2
diff --git a/app/models/user_category.rb b/app/models/user_category.rb
index d5cfaa3..968b996 100644
--- a/app/models/user_category.rb
+++ b/app/models/user_category.rb
@@ -7,8 +7,8 @@ class UserCategory < ActiveRecord::Base
timestamps
end
- belongs_to :user
- belongs_to :question_category
+ belongs_to :user, :null => false
+ belongs_to :question_category, :null => false
validates_uniqueness_of :user_id, :scope => :question_category_id
diff --git a/app/models/user_question_group.rb b/app/models/user_question_group.rb
index 7d6e2d7..5319984 100644
--- a/app/models/user_question_group.rb
+++ b/app/models/user_question_group.rb
@@ -5,8 +5,8 @@ class UserQuestionGroup < ActiveRecord::Base
fields do
timestamps
end
- belongs_to :user
- belongs_to :question
+ belongs_to :user, :null => false
+ belongs_to :question, :null => false
validates_presence_of :question
validate :question_has_category
diff --git a/db/schema.rb b/db/schema.rb
index c9db40b..b79b86f 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,15 +9,15 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100729170624) do
+ActiveRecord::Schema.define(:version => 20100805164943) do
create_table "answers", :force => true do |t|
- t.text "content"
+ t.text "content", :null => false
t.boolean "approved", :default => false
t.boolean "reference", :default => false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "question_id"
+ t.integer "question_id", :null => false
t.integer "owner_id"
t.string "type"
t.string "feedback", :default => ""
@@ -29,10 +29,10 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
add_index "answers", ["type"], :name => "index_answers_on_type"
create_table "comments", :force => true do |t|
- t.text "content"
+ t.text "content", :null => false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "answer_id"
+ t.integer "answer_id", :null => false
t.integer "owner_id"
end
@@ -40,11 +40,11 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
add_index "comments", ["owner_id"], :name => "index_comments_on_owner_id"
create_table "options", :force => true do |t|
- t.string "content"
+ t.string "content", :null => false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "option_owner_id"
- t.string "option_owner_type"
+ t.integer "option_owner_id", :null => false
+ t.string "option_owner_type", :null => false
end
add_index "options", ["option_owner_type", "option_owner_id"], :name => "index_options_on_option_owner_type_and_option_owner_id"
@@ -54,23 +54,23 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
t.boolean "accepted", :default => false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "user_id"
+ t.integer "user_id", :null => false
end
add_index "project_acceptances", ["user_id"], :name => "index_project_acceptances_on_user_id"
create_table "question_categories", :force => true do |t|
- t.string "name"
+ t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "question_content_emails", :force => true do |t|
- t.text "requirements", :default => ""
+ t.text "requirements", :default => "", :null => false
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "question_id"
+ t.integer "question_id", :null => false
end
add_index "question_content_emails", ["question_id"], :name => "index_question_content_emails_on_question_id"
@@ -79,7 +79,7 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
t.text "content", :null => false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "question_id"
+ t.integer "question_id", :null => false
end
add_index "question_content_multiple_choices", ["question_id"], :name => "index_question_content_multiple_choices_on_question_id"
@@ -88,7 +88,7 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
t.text "content", :null => false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "question_id"
+ t.integer "question_id", :null => false
end
add_index "question_content_texts", ["question_id"], :name => "index_question_content_texts_on_question_id"
@@ -118,8 +118,8 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
create_table "user_categories", :force => true do |t|
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "user_id"
- t.integer "question_category_id"
+ t.integer "user_id", :null => false
+ t.integer "question_category_id", :null => false
end
add_index "user_categories", ["question_category_id"], :name => "index_user_categories_on_question_category_id"
@@ -128,8 +128,8 @@ ActiveRecord::Schema.define(:version => 20100729170624) do
create_table "user_question_groups", :force => true do |t|
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "user_id"
- t.integer "question_id"
+ t.integer "user_id", :null => false
+ t.integer "question_id", :null => false
end
add_index "user_question_groups", ["question_id"], :name => "index_user_question_groups_on_question_id"