aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-19 15:03:52 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-27 23:02:44 +0200
commit5b6f3a04af3167f7e1ef12525cf9a0130f898572 (patch)
tree08cfd7697bb148d561b44941f1b7059c9563c9bc /app
parentImproved readability of ProjectAcceptance model (diff)
downloadrecruiting-webapp-5b6f3a04af3167f7e1ef12525cf9a0130f898572.tar.gz
recruiting-webapp-5b6f3a04af3167f7e1ef12525cf9a0130f898572.tar.bz2
recruiting-webapp-5b6f3a04af3167f7e1ef12525cf9a0130f898572.zip
Empty lines improving readability
Diffstat (limited to 'app')
-rw-r--r--app/models/answer.rb1
-rw-r--r--app/models/question.rb3
-rw-r--r--app/models/question_category.rb1
-rw-r--r--app/models/question_content_multiple_choice.rb9
-rw-r--r--app/models/question_content_text.rb4
5 files changed, 12 insertions, 6 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb
index 7830389..c4e8a93 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -13,6 +13,7 @@ class Answer < ActiveRecord::Base
:default => ''
timestamps
end
+
attr_readonly :reference
belongs_to :question
has_many :comments
diff --git a/app/models/question.rb b/app/models/question.rb
index a6b09ed..d97c361 100644
--- a/app/models/question.rb
+++ b/app/models/question.rb
@@ -3,7 +3,7 @@ class Question < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- title :string
+ title :string, :null => false
documentation :string
approved :boolean, :default => false
timestamps
@@ -11,6 +11,7 @@ class Question < ActiveRecord::Base
attr_readonly :user
validates_presence_of :title
+ validates_length_of :title, :minimum => 2
#allow empty documentation and no category
#maybe add a page for not complete questions
diff --git a/app/models/question_category.rb b/app/models/question_category.rb
index d6b5723..abda45a 100644
--- a/app/models/question_category.rb
+++ b/app/models/question_category.rb
@@ -12,6 +12,7 @@ class QuestionCategory < ActiveRecord::Base
has_many :questions
has_many :user_categories
has_many :users, :through => :user_categories, :accessible => true
+
include Permissions::AnyoneCanViewAdminCanChange
def self.as_select_opts
diff --git a/app/models/question_content_multiple_choice.rb b/app/models/question_content_multiple_choice.rb
index c3315c3..f1b3298 100644
--- a/app/models/question_content_multiple_choice.rb
+++ b/app/models/question_content_multiple_choice.rb
@@ -4,13 +4,14 @@ class QuestionContentMultipleChoice < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- content HoboFields::MarkdownString
+ content HoboFields::MarkdownString, :null => false
timestamps
end
- belongs_to :question
- attr_readonly :question
- has_many :options, :as => :option_owner, :accessible => true, :uniq => true
+ belongs_to :question
+ attr_readonly :question
+ has_many :options, :as => :option_owner, :accessible => true, :uniq => true
+ validates_length_of :content, :minimum => 2
inherit_permissions(:question)
diff --git a/app/models/question_content_text.rb b/app/models/question_content_text.rb
index 78cebee..4ce78c1 100644
--- a/app/models/question_content_text.rb
+++ b/app/models/question_content_text.rb
@@ -4,13 +4,15 @@ class QuestionContentText < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
- content HoboFields::MarkdownString
+ content HoboFields::MarkdownString, :null => false
timestamps
end
belongs_to :question
attr_readonly :question
+ validates_length_of :content, :minimum => 2
+
inherit_permissions(:question)
def new_answer_of(user)