aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorPhilip Arndt <p@arndt.io>2013-09-14 10:00:42 +1200
committerPhilip Arndt <p@arndt.io>2013-09-16 04:56:47 +1200
commita8b5bce609089af8795768230c7dd3a9b87cd5e0 (patch)
tree22a2a154da2b48988c9c4e05600e52fa1b884bf1 /app/controllers
parent5ae082d79e554d3449083aa70ef64ef5d677759a (diff)
downloadrefinerycms-blog-a8b5bce609089af8795768230c7dd3a9b87cd5e0.tar.gz
refinerycms-blog-a8b5bce609089af8795768230c7dd3a9b87cd5e0.tar.bz2
refinerycms-blog-a8b5bce609089af8795768230c7dd3a9b87cd5e0.zip
Supported Rails 4 and Refinery 3.0.0.dev
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/refinery/blog/categories_controller.rb2
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb14
2 files changed, 10 insertions, 6 deletions
diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb
index 23a835a..b5ab574 100644
--- a/app/controllers/refinery/blog/categories_controller.rb
+++ b/app/controllers/refinery/blog/categories_controller.rb
@@ -3,7 +3,7 @@ module Refinery
class CategoriesController < BlogController
def show
- @category = Refinery::Blog::Category.find(params[:id])
+ @category = Refinery::Blog::Category.friendly.find(params[:id])
@posts = @category.posts.live.includes(:comments, :categories).with_globalize.page(params[:page])
end
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index 05cd2d6..20ac12b 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -2,7 +2,7 @@ module Refinery
module Blog
class PostsController < BlogController
- before_filter :find_all_blog_posts, :except => [:archive]
+ before_filter :paginate_all_blog_posts, :except => [:archive]
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
before_filter :find_tags
@@ -10,9 +10,12 @@ module Refinery
def index
if request.format.rss?
- @posts = Post.live.includes(:comments, :categories)
- # limit rss feed for services (like feedburner) who have max size
- @posts = Post.recent(params["max_results"]) if params["max_results"].present?
+ @posts = if params["max_results"].present?
+ # limit rss feed for services (like feedburner) who have max size
+ Post.recent(params["max_results"])
+ else
+ Post.newest_first.live.includes(:comments, :categories)
+ end
end
respond_with (@posts) do |format|
format.html
@@ -34,7 +37,8 @@ module Refinery
end
def comment
- if (@comment = @post.comments.create(params[:comment])).valid?
+ @comment = @post.comments.create(params[:comment])
+ if @comment.valid?
if Comment::Moderation.enabled? or @comment.ham?
begin
CommentMailer.notification(@comment, request).deliver