How can I order posts in descending order
<p>I'm making a blog type site, and I'd like the posts to be displayed newest first(descending order) Ive tried a few different things and haven't been able to figure it out. This is my current code: </p>

<p>post.html.erb </p>

<pre><code>&lt;%= @posts.each do |post|%&gt;
&lt;div&gt;
    &lt;p&gt;&lt;%= avatar_for(post.user, size: 40) %&gt;
    &lt;%= link_to post.username, post.user %&gt;&lt;/p&gt;
    &lt;h2&gt;
        &lt;%= link_to post.title, post %&gt;
    &lt;/h2&gt;

&lt;/div&gt;
    &lt;% end%&gt;
</code></pre>

<p>post controller </p>

<pre><code>class PostsController &lt; ApplicationController 
    before_action :authenticate_user!
    def posts
        @posts = Post.all.order("created_at DESC")
    end


    def new 
        @post = Post.new 
    end 

    def create 
        @post = current_user.posts.new(post_params)
        if @post.save 
        redirect_to post_path(@post)
        else 
            render :new 
        end
    end 

    def show
        @post = Post.find(params[:id])
    end


    private 
    def post_params
        params.require(:post).permit(:title, :body, :all_tags)
    end 
end 
</code></pre>