我有一个问题,我无法弄清楚产品控制器错误的问题所在,我不会呈现我想要工作的产品索引视图页面。
我的代码如下:提供控制器
class OffersController < ApplicationController
  attr_accessible :product , :reserve_price
  def your_offer
    @your_offer = Offer.new
  end
  def new
    @offer = Offer.new = :your_offer
  end
end
和产品控制器
class ProductsController < ApplicationController
      before_filter :authenticate, :except => [:index, :show]
      # GET /products
      # GET /products.xml
      def index
        @offer = Offer.new
         @products = Product.search(params[:search_query])
         respond_to do |format|
              format.html # index.html.erb
        format.xml  { render :xml => @products }
       end
      end
     # GET /products/1
     # GET /products/1.xml
     def show
         @product = Product.find(params[:id])
        respond_to do |format|
         format.html # show.html.erb
        format.xml  { render :xml => @product }
       end
     end
     # GET /products/new
     # GET /products/new.xml
     def new
      @product = Product.new
       respond_to do |format|
        format.html # new.html.erb
        format.xml  { render :xml => @product }
       end
     end
      # GET /products/1/edit
     def edit
       @product = Product.find(params[:id])
     end
     # POST /products
     # POST /products.xml
     def create
       @product = current_user.products.new(params[:product])
    respond_to do |format|
      if @product.save
        format.html { redirect_to(@product, :notice => 'Product was successfully created.') }
        format.xml  { render :xml => @product, :status => :created, :location => @product }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @product.errors, :status => :unprocessable_entity }
      end
    end
  end
     # PUT /products/1
     # PUT /products/1.xml
     def update
    @product = Product.find(params[:id])
    respond_to do |format|
      if @product.update_attributes(params[:product])
        format.html { redirect_to(@product, :notice => 'Product was successfully     updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @product.errors, :status => :unprocessable_entity }
      end
    end
  end
     # DELETE /products/1
    # DELETE /products/1.xml
  def destroy
    @product = Product.find(params[:id])
    @product.destroy
    respond_to do |format|
      format.html { redirect_to(products_url) }
      format.xml  { head :ok }
    end
  end
end
报价模式
class Offer < ActiveRecord::Base
     belongs_to :product
  has_many :reserve_prices
  attr_accessible :product, :offer , :reserve_price
  validates_presence_of :offer
  validate :ensure_meets_reserve_price
  private
  def ensure_meets_reserve_price
    if amount < self.product.reserve_price
      errors.add(:amount, "does not meet reserve price")
    end
  end
  private
  def reserve_price
     product.reserve_price
  end
  def your_offer
    @your_offer = Offer.new
  end
  def new
    @offer = Offer.new = :your_offer
  end
end
产品索引 viex 片段
<%= form_for @offer do |f| %>
    <%= f.text_field :your_offer %>
    <%= f.submit "Make Offer" %>
<% end %>
谁能看到我的错误在哪里?