mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 08:52:14 -04:00
Removed redundant @recent_posts instance variable
Not required, as we have pagination by default
This commit is contained in:
@@ -5,7 +5,6 @@ class PostsController < ApplicationController
|
||||
|
||||
def index
|
||||
@posts = Post.paginate(:page => params[:page])
|
||||
@recent_posts = Post.limit(100).order('created_at desc').all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.haml
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
%channel
|
||||
%title #{Growstuff::Application.config.site_name} - Recent posts from all members
|
||||
%link= posts_url
|
||||
- @recent_posts.each do |post|
|
||||
- @posts.each do |post|
|
||||
%item
|
||||
%author= post.author.login_name
|
||||
%title= post.subject
|
||||
|
||||
@@ -13,7 +13,6 @@ describe PostsController do
|
||||
post = Post.create! valid_attributes
|
||||
get :index, {}
|
||||
assigns(:posts).should eq([post])
|
||||
assigns(:recent_posts).should eq([post])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ describe 'posts/index.rss.haml', :type => "view" do
|
||||
before(:each) do
|
||||
controller.stub(:current_user) { nil }
|
||||
@author = FactoryGirl.create(:member)
|
||||
assign(:recent_posts, [
|
||||
assign(:posts, [
|
||||
FactoryGirl.build(:post, :id => 1, :author => @author),
|
||||
FactoryGirl.build(:post, :id => 2, :author => @author)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user