models: drop unnecessary presence validations.
In rails 5, belongs_to associations automatically validate that the associated item is present, meaning that we don't need to validate these things manually any more.
This commit is contained in:
@@ -17,7 +17,7 @@ class ForumTopic < ApplicationRecord
|
||||
has_one :original_post, -> {order("forum_posts.id asc")}, class_name: "ForumPost", foreign_key: "topic_id", inverse_of: :topic
|
||||
has_many :subscriptions, :class_name => "ForumSubscription"
|
||||
before_validation :initialize_is_deleted, :on => :create
|
||||
validates_presence_of :title, :creator_id
|
||||
validates_presence_of :title
|
||||
validates_associated :original_post
|
||||
validates_inclusion_of :category_id, :in => CATEGORIES.keys
|
||||
validates_inclusion_of :min_level, :in => MIN_LEVELS.values
|
||||
|
||||
Reference in New Issue
Block a user