2

这是什么错误?BrandsController#index 中的 ArgumentError 参数数量错误(1 为 2) 我在控制器中的索引代码是:

  def index
    @brands = Brand.all
    #@brands = Brand.paginate :page => params[:page],:per_page => 6 
    respond_to do |format|
      format.html
      format.xml { render :xml => @brands.to_xml }
    end
  end 

我的 index.html.haml 视图代码是:

- content_for :title do
  Listing Brands
- content_for :div do
  Listing Brands
- content_for :subnav do
  #navigation-search
    /= yield :brand_img
    %img{:src => "images/lifestyle.gif", :height => "35"}
    /= link_to 'Change Brand', new_brand_path
    %a.Metro-16{:href => new_brand_path, :title => "Change brand"} Change Brand   
  = render :partial => 'updatemesg'

- content_for :brand_img do 
  %img{:src => "images/lifestyle.gif", :height => "35"}
-#
  - content_for :subnav do
    #navigation-search
      %form
        #{yield :brand_img}

  %ul
    %li
      %a.tt-top-center{:title => "Total Events"}#{Event.all.size}
      %span Total events
    %li
      %a.blue.tt-top-center{:title => "Today's Events"} 12
      %span Today's Events
    %li
      %a.green.tt-top-center{:title => "Tomorrow's Events"} 3
      %span Tomorrow's Events
    %li
      %a.tt-top-center{:title => "Upcoming Events"} 7
      %span Upcoming Events

  %a#show-modal.create-24.tt-top-center{:href => new_brand_path, :title => "New Brand"} New Brand

- @brands.each do |brand|
  .ovr
    %ol.hoverbox
      %li
        = link_to image_tag(brand.photo.url, :alt => brand.name, :class => "preview"), brand_path(brand)
        /= link_to image_tag(brand.photo.url), { :class => "preview"}
        .abc      
          = brand.name

我不明白为什么会出现这个错误 BrandsController#index 中的 ArgumentError 参数数量错误(2 比 1)

4

0 回答 0