title: Rails - Making a page viewable to admin only
body: <p>I have a super simple question. I have a page that lists all the products in my app. I just want to make that page view-able by admin only. But products/new I want everyone to be able to see clearly.</p>
  
  <p><strong>schema.rb</strong></p>
  
  <pre><code>  create_table "users", :force =&gt; true do |t|
      t.string   "email"
      t.string   "password_hash"
      t.string   "password_salt"
      t.datetime "created_at",      :null =&gt; false
      t.datetime "updated_at",      :null =&gt; false
      t.string   "name"
      t.boolean  "admin",           :default =&gt; false
    end
  </code></pre>
  
  <p><strong>products controller</strong></p>
  
  <pre><code>class ProductsController &lt; ApplicationController
      before_filter :require_login
      before_filter :current_user, only: [:create, :destory]
      before_filter :correct_user, only: :destory
  
    def index
      @products = Product.all
    end
  
    def new 
      @product = Product.new
    end
  
    def create
    @product = current_user.products.new(params[:product])
      if @product.valid? 
        @product.save
          render "show", :notice =&gt; "Sale created!"
      else
          render "new", :notice =&gt; "Somehting went wrong!"
      end
  end
  </code></pre>