I have a blog like rails app with posts. the posts can be order by most popular or newest. The most popular is the default order and the homepage, Id like to change this to be the newest order instead. Since Im still pretty new to rails I hired a programmer to do most of the work, However I know this is a pretty simple fix, I just don't know what to change. I think its something I need to change in either the post\_controller or the post model, but If you nee to see something else let me know and ill put it up. 

post.rb 

```
class Post < ActiveRecord::Base
 include UrlHelp

   def self.highest_voted
  self.order(:cached_votes_down)
 end
end

```

post\_controller.rb

```
 def index
 @posts = grab_correct_post
 end

def grab_correct_post
  if params[:sort_by] == "added_on"
  @added_on = "sort-active"
  Post.all.order("created_at DESC").paginate(page: params[:page],  per_page: 7)
else
  @most_popular = "sort-active"
  Post.all.order(:cached_votes_score =>:desc).paginate(page: params[:page], per_page: 7)
   end

```