mysql> DESCRIBE wiki_content_versions;
+-----------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+---------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| wiki_content_id | int(11) | NO | MUL | NULL | |
| page_id | int(11) | NO | | NULL | |
| author_id | int(11) | YES | | NULL | |
| data | longblob | YES | | NULL | |
| compression | varchar(6) | YES | | | |
| comments | varchar(1024) | YES | | | |
| updated_on | datetime | NO | MUL | NULL | |
| version | int(11) | NO | | NULL | |
+-----------------+---------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)
--- app/models/wiki_content.rb.orig 2015-05-17 13:01:37.000000000 -0400
+++ app/models/wiki_content.rb 2015-05-19 13:40:35.285843848 -0400
@@ -21,8 +21,8 @@
self.locking_column = 'version'
belongs_to :page, :class_name => 'WikiPage'
belongs_to :author, :class_name => 'User'
- validates_presence_of :text
- validates_length_of :comments, :maximum => 255, :allow_nil => true
+ validates_presence_of :text, :comments
+ validates_length_of :comments, :maximum => 1024, :allow_nil => false
attr_protected :id
acts_as_versioned
Let's not do that. :)
Note: This patch (partly) makes the comment field mandatory. That might not be what you want. It would be nice to have a way to require this field without patching the application though. :)