打印

rails Extracted source

rails Extracted source

controller.rb
复制内容到剪贴板
代码:
def edit
    @classified = Classified.find(params[:id])
  end
  
list.rhtml
复制内容到剪贴板
代码:
<%if @classifieds.blank?%>
    <h1>There are not ads currently in this system</h1>
<%else%>
    <p>There are the classified ads in our system</p>

    <p>
       <ul id="classifieds">
            <%@classifieds.each do |c|%>
                <li>
                    <%=link_to c.title,{:action=>'show',:id=>c.id}-%>
                    <small>
                        [<%=link_to 'Edit',{:action=>'edit',:id=>c.id}%>]
                    </small>
                    <small>
                        [<%=link_to 'Delete',{:action=>'delete',:id=>c.id},:confirm=>'Are you sure to delete this classified?'%>]
                    </small>
                </li>
            <%end%>
            
       </ul>
    </p>
<%end%>
<p><%=link_to "Add a new",'new'%></p>
edit.rhtml
复制内容到剪贴板
代码:
<h1>Editing Classified:<%=@classified.title-%><h1>
<%=form_tag :action=>'update', :id=@classified%>

<p><label for="classified_title">Title:</label>

<%=text_field 'classified' , 'title'%></p>

<p><label for="classified_price">Price:</label>

<%=text_field 'classified' , 'price'%></p>

<p><label for="classified_location">Location:</label>

<%=text_field 'classified' , 'location'%></p>

<p><label for="classified_description">Description:</label>

<%=text_area 'classified' , 'description'%></p>

<p><label for="classified_email">Email:</label>

<%=text_field 'classified' , 'email'%></p>

<%=submit_tag "Save Change"%>
<%=form_tag%>

<%=link_to "Back", {:action=>'list'}%>
错误如图,高手帮帮忙啊!
附件: 您所在的用户组无法下载或查看附件
Try to know something of everything before you know everything of something!

TOP

引用:
<%=form_tag :action=>'update', :id=@classified%>
:id=?
First they ignore you, then they laugh at you, then they fight you, then you win.

TOP