Class: Blogpostify::Post

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ActionView::Helpers::SanitizeHelper
Defined in:
lib/blogpostify/post.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_from_item(blog_name, post_item) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/blogpostify/post.rb', line 14

def create_from_item(blog_name, post_item)
  post = self.new
  post.blog_id = blog_name
  post.title = post_item.title
  post.description = sanitize_description(post_item.description)
  post.guid = post_item.guid.content.to_s
  post.published_at = post_item.pubDate
  post.link = post_item.link
  post.save
  post
end

Instance Method Details

#blogObject



34
35
36
# File 'lib/blogpostify/post.rb', line 34

def blog
  @blog ||= Blogpostify.find_blog!(self.blog_id)
end