Class: ProductsController

Inherits:
ApplicationController show all
Defined in:
lib/forge/app/controllers/products_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#app_init

Instance Method Details

#indexObject

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

#previewObject



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

#showObject

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