diff options
author | Marek Labos <keraml@gmail.com> | 2012-08-29 20:53:27 +0200 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2012-11-23 09:37:15 +1300 |
commit | f6dbe316f9f793369029db51efe695ec9766c6c1 (patch) | |
tree | fb6f89e370a83b814be3083e037f4ad6c4d3cbfb /app | |
parent | e4901f37829cd0769d48c118214f87c2c6f035ac (diff) | |
download | refinerycms-blog-f6dbe316f9f793369029db51efe695ec9766c6c1.tar.gz refinerycms-blog-f6dbe316f9f793369029db51efe695ec9766c6c1.tar.bz2 refinerycms-blog-f6dbe316f9f793369029db51efe695ec9766c6c1.zip |
Fix bugs with globalize, published_before and clean code
Fixes #276
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/refinery/blog/posts_controller.rb | 4 | ||||
-rw-r--r-- | app/models/refinery/blog/post.rb | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index ed94a8d..b5caa33 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -10,7 +10,7 @@ module Refinery def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@posts = Post.live.includes(:comments, :categories).with_globalize) if request.format.rss? + (@posts = Post.live.includes(:comments, :categories)) if request.format.rss? respond_with (@posts) do |format| format.html format.rss { render :layout => false } @@ -71,7 +71,7 @@ module Refinery def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @posts = Post.tagged_with(@tag_name).with_globalize.page(params[:page]) + @posts = Post.live.tagged_with(@tag_name).page(params[:page]) end protected diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb index 70c7861..881a4ec 100644 --- a/app/models/refinery/blog/post.rb +++ b/app/models/refinery/blog/post.rb @@ -87,7 +87,7 @@ module Refinery end def by_month(date) - where(:published_at => date.beginning_of_month..date.end_of_month).with_globalize + where(:published_at => date.beginning_of_month..date.end_of_month) end def by_archive(date) @@ -100,11 +100,11 @@ module Refinery end def published_dates_older_than(date) - published_before(date).with_globalize.pluck(:published_at) + published_before(date).pluck(:published_at) end def recent(count) - live.limit(count).with_globalize + live.limit(count) end def popular(count) @@ -112,11 +112,11 @@ module Refinery end def previous(item) - published_before(item.published_at).with_globalize.first + published_before(item.published_at).first end def uncategorized - live.includes(:categories).where(Refinery::Categorization.table_name => { :blog_category_id => nil }).with_globalize + live.includes(:categories).where(Refinery::Categorization.table_name => { :blog_category_id => nil }) end def next(current_record) |