Class: WPDB::Post

Inherits:
Object
  • Object
show all
Includes:
Termable
Defined in:
lib/ruby-wpdb/posts.rb

Instance Method Summary collapse

Methods included from Termable

#add_term

Instance Method Details

#before_validationObject



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.menu_order     ||= 0
  self.comment_status ||= "open"
  self.ping_status    ||= WPDB::Option.get_option("default_ping_status")
  self.      ||= Time.now
  self.  ||= Time.now.utc
  super
end

#validateObject



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