Class: Kublog::Post

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/kublog/post.rb

Instance Method Summary collapse

Instance Method Details

#authorObject



23
24
25
# File 'app/models/kublog/post.rb', line 23

def author
  user.to_s
end


38
39
40
41
42
# File 'app/models/kublog/post.rb', line 38

def related_posts
  unless self.category.nil?
    self.category.posts.where('id != ?', self.id)
  end
end

#to_sObject



27
28
29
# File 'app/models/kublog/post.rb', line 27

def to_s
  title
end

#urlObject

Public Access to the Post



32
33
34
35
36
# File 'app/models/kublog/post.rb', line 32

def url
  unless new_record?
    Engine.routes.url_helpers.quickie_url(self, :host => Kublog.default_url_options[:host])
  end
end