好吧,这个问题我敢肯定这根本不难,但是对于 Rails 的新手,我有点迷路了。看完 Railscasts 第 52 集后,我继续制作自己的发布/取消发布幻灯片列表。
所以这是表单视图
    = form_tag publish_admin_category_slides_path(@cat4), :method => "put"  do 
#pricing    
    %table#plans
        %thead
            %tr
                %th Image
                %th Published
        %tbody
        - @image.each do |im|
            %tr.odd
                %td
                    = image_tag im.avatar.url(:thumb)
                    = link_to "Delete", admin_category_slide_path(@cat4,im), :method =>  "delete"
                    %span is
                %th 
                    = check_box_tag "slide_published[]", im.published ,im.published
使用控制器操作 #publish
    def publish
    Slide.update_all(:published => params[:slide_published])
    redirect_to :action => "index"
    end
写这样的东西的正确方法是什么?带有复选框的列表可以更改属性的布尔状态和多次更新?