Class: ProductsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ProductsController
- Defined in:
- lib/forge/app/controllers/products_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /products GET /products.xml.
- #preview ⇒ Object
-
#show ⇒ Object
GET /products/1 GET /products/1.xml.
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
GET /products GET /products.xml
6 7 8 9 10 11 12 |
# File 'lib/forge/app/controllers/products_controller.rb', line 6 def index @products = Product.published.find(:all, :order => "featured DESC, title") respond_to do |format| format.html # index.html.erb format.xml { render :xml => @products } end end |
#preview ⇒ Object
25 26 27 28 29 |
# File 'lib/forge/app/controllers/products_controller.rb', line 25 def preview flash.now[:notice] = "Please note that product images do not appear in previews." @product = Product.new(params[:product]) render :action => :show end |
#show ⇒ Object
GET /products/1 GET /products/1.xml
16 17 18 19 20 21 22 23 |
# File 'lib/forge/app/controllers/products_controller.rb', line 16 def show @product = Product.find(params[:id]) @page_title = @product.seo_title.blank? ? @product.title : @product.seo_title respond_to do |format| format.html # show.html.erb format.xml { render :xml => @product } end end |