Class: Blogit::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Blogit::Post
- Defined in:
- app/models/blogit/post.rb
Class Method Summary (collapse)
-
+ (Object) for_index
Returns the blog posts paginated for the index page.
Instance Method Summary (collapse)
-
- (Object) blogger_display_name
If there's a current blogger and the display name method is set, returns the blogger's display name Otherwise, returns an empty string.
- - (Object) comments
- - (Object) comments=(value)
-
- (Object) to_param
Instance Methods =
.
Class Method Details
+ (Object) for_index
Returns the blog posts paginated for the index page
49 |
# File 'app/models/blogit/post.rb', line 49 scope :for_index, lambda { |page_no = 1| order("created_at DESC").page(page_no) } |
Instance Method Details
- (Object) blogger_display_name
If there's a current blogger and the display name method is set, returns the blogger's display name Otherwise, returns an empty string
61 62 63 64 65 66 67 68 69 70 |
# File 'app/models/blogit/post.rb', line 61 def blogger_display_name if self.blogger and !self.blogger.respond_to?(Blogit.configuration.blogger_display_name_method) raise ConfigurationError, "#{self.blogger.class}##{Blogit.configuration.blogger_display_name_method} is not defined" elsif self.blogger.nil? "" else self.blogger.send Blogit.configuration.blogger_display_name_method end end |
- (Object) comments
34 35 36 37 |
# File 'app/models/blogit/post.rb', line 34 def comments check_comments_config super() end |
- (Object) comments=(value)
38 39 40 41 |
# File 'app/models/blogit/post.rb', line 38 def comments=(value) check_comments_config super(value) end |
- (Object) to_param
Instance Methods =
55 56 57 |
# File 'app/models/blogit/post.rb', line 55 def to_param "#{id}-#{title.parameterize}" end |