Created
January 24, 2013 15:01
-
-
Save boska/4622678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
if params[:tag] | |
@posts = Post.order('updated_at desc').page(params[:page]).per(10).tagged_with(params[:tag]) | |
else | |
#@posts = Post.paginate(:per_page => 5 ,:page => params[:page],:order =>"updated_at DESC") | |
@posts = Post.order('updated_at desc').page(params[:page]).per(10) | |
respond_to do |format| | |
format.html | |
format.js | |
end | |
end | |
end | |
#newest post order | |
def tally #總數大於5 加總大於0 | |
@posts = Post.plusminus_tally.having('vote_count > 5 AND plusminus_tally > 0').page(params[:page]).per(10) | |
#@posts = Post.plusminus_tally.having('vote_count > 5').page(params[:page]).per(10).reverse() | |
respond_to do |format| | |
format.html {render :index} | |
format.js {render :index} | |
end | |
end | |
def feeds | |
@posts = Post.order('created_at desc').page(params[:page]).per(10) | |
respond_to do |format| | |
format.html {render :index} | |
format.js {render :index} | |
end | |
end | |
def videos | |
@posts = Post.order('updated_at desc').page(params[:page]).per(10).tagged_with('video') | |
respond_to do |format| | |
format.html {render :index} | |
format.js {render :index} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment