diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-07-19 15:03:52 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-07-27 23:02:44 +0200 |
commit | 5b6f3a04af3167f7e1ef12525cf9a0130f898572 (patch) | |
tree | 08cfd7697bb148d561b44941f1b7059c9563c9bc | |
parent | Improved readability of ProjectAcceptance model (diff) | |
download | recruiting-webapp-5b6f3a04af3167f7e1ef12525cf9a0130f898572.tar.gz recruiting-webapp-5b6f3a04af3167f7e1ef12525cf9a0130f898572.tar.bz2 recruiting-webapp-5b6f3a04af3167f7e1ef12525cf9a0130f898572.zip |
Empty lines improving readability
-rw-r--r-- | app/models/answer.rb | 1 | ||||
-rw-r--r-- | app/models/question.rb | 3 | ||||
-rw-r--r-- | app/models/question_category.rb | 1 | ||||
-rw-r--r-- | app/models/question_content_multiple_choice.rb | 9 | ||||
-rw-r--r-- | app/models/question_content_text.rb | 4 | ||||
-rw-r--r-- | db/schema.rb | 8 |
6 files changed, 16 insertions, 10 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) diff --git a/db/schema.rb b/db/schema.rb index 3a15be1..588f4e9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20100727204158) do +ActiveRecord::Schema.define(:version => 20100727204251) do create_table "answers", :force => true do |t| t.text "content" @@ -65,7 +65,7 @@ ActiveRecord::Schema.define(:version => 20100727204158) do end create_table "question_content_multiple_choices", :force => true do |t| - t.text "content" + t.text "content", :null => false t.datetime "created_at" t.datetime "updated_at" t.integer "question_id" @@ -74,7 +74,7 @@ ActiveRecord::Schema.define(:version => 20100727204158) do add_index "question_content_multiple_choices", ["question_id"], :name => "index_question_content_multiple_choices_on_question_id" create_table "question_content_texts", :force => true do |t| - t.text "content" + t.text "content", :null => false t.datetime "created_at" t.datetime "updated_at" t.integer "question_id" @@ -90,7 +90,7 @@ ActiveRecord::Schema.define(:version => 20100727204158) do end create_table "questions", :force => true do |t| - t.string "title" + t.string "title", :null => false t.string "documentation" t.boolean "approved", :default => false t.datetime "created_at" |