Sha256: 7395d437e25d0d742185b58763bed7215ab8c76ab183318e594f6107370ac5bc
Contents?: true
Size: 957 Bytes
Versions: 1
Compression:
Stored size: 957 Bytes
Contents
require "active_record" class PagePost < ActiveRecord::Base set_table_name :wp_posts set_primary_key :ID before_save :update_date before_create :set_default_values validates_presence_of :post_author has_many :comments, :foreign_key => :comment_post_ID def set_default_values t = Time.now self.post_date = t self.post_date_gmt = t.gmtime # Ready for when Site model is added # site_url = Site.find_by_option_name "siteurl" # type = 'p' # if self.type == "Page" # type << 'age_id' # end # self.guid = "#{site_url}/?#{type}=#{self.id}" urlify = self.post_title.dup.downcase.gsub(' ', '-') self.post_name = urlify end def update_date t = Time.now self.post_modified = t self.post_modified_gmt = t.gmtime end def title post_title end def title= new_title self.post_title = new_title end def content post_content end def content= new_content self.post_content = new_content end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wpb-0.0.3 | lib/wpb/pagepost.rb |