Well, thank you for scrutinizing this. @eviltrout my first instinct should’ve been to check the server. ![]()
So, while I know how to remedy the problem, I still don’t know why it happens.
My plugin uses a callback
DiscourseEvent.on(:post_created) do |post, opts, user|
#the work
end
Before now, I did not have a guard clause checking the post_type. Now, I make sure it’s post_type == 1 (the pinned “post” was type 3). For some reason, not having the guard clause would raise this error, on the newly created post:
ActiveRecord::RecordInvalid - Validation failed: Body is too short (minimum is 20 characters), Body seems unclear, is it a complete sentence?:
activerecord (4.2.7.1) lib/active_record/validations.rb:79:in `raise_record_invalid'
activerecord (4.2.7.1) lib/active_record/validations.rb:43:in `save!'
activerecord (4.2.7.1) lib/active_record/attribute_methods/dirty.rb:29:in `save!'
activerecord (4.2.7.1) lib/active_record/transactions.rb:291:in `block in save!'
activerecord (4.2.7.1) lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
activerecord (4.2.7.1) lib/active_record/transactions.rb:220:in `transaction'
activerecord (4.2.7.1) lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
activerecord (4.2.7.1) lib/active_record/transactions.rb:291:in `save!'
Edit: The weird part to me is that this validation (which probably normally doesn’t run for post_type 3) did run when the I delineated the callback.