Class: WPDB::Post
Instance Method Summary collapse
Methods included from Termable
Instance Method Details
#before_validation ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ruby-wpdb/posts.rb', line 51 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
45 46 47 48 49 |
# File 'lib/ruby-wpdb/posts.rb', line 45 def validate super validates_presence [:post_title, :post_type, :post_status] validates_unique :post_name end |