Class: WPDB::Post
Instance Method Summary collapse
Methods included from Termable
Instance Method Details
#before_validation ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ruby-wpdb/post.rb', line 54 def before_validation self.post_type ||= "post" self.post_status ||= "draft" self.post_parent ||= 0 self. ||= 0 self.comment_status ||= "open" self.ping_status ||= WPDB::Option.get_option("default_ping_status") self.post_date ||= Time.now self.post_date_gmt ||= Time.now.utc super end |
#validate ⇒ Object
48 49 50 51 52 |
# File 'lib/ruby-wpdb/post.rb', line 48 def validate super validates_presence [:post_title, :post_type, :post_status] validates_unique :post_name end |