2012-12-13 4 views
-1

레일을 사용하여 스캐 폴딩을 생성합니다. 내가 편집 버튼 means.it이 지금 내가 할 때 nextpage하지 않는 서버 hit.means없이 작업을 수행 할 .. 다음 페이지와 같은 페이지를 편집로 이동합니다 클릭하면 이 내 인덱스 페이지스캐 폴딩에서이 작업을 수행하는 방법

<%- model_class = Tasktodo -%> 
<div class="page-header"> 
    <h1><%=t 'title', :default => model_class.model_name.human.pluralize %></h1> 
</div> 
<table class="table table-striped"> 
    <thread> 
    <tr> 
     <th><%= model_class.human_attribute_name(:id) %></th> 
     <th><%= model_class.human_attribute_name(:name) %></th> 
     <th><%= model_class.human_attribute_name(:tname) %></th> 
     <th><%= model_class.human_attribute_name(:created_at) %></th> 
     <th><%=t '.actions', :default => t("helpers.actions") %></th> 
    </tr> 
    </thead> 
    <tbody> 
<div id="edit"> 
    <% @tasktodos.each do |tasktodo| %> 
     <tr> 
     <td><%= link_to tasktodo.id, tasktodo_path(tasktodo) %></td> 
     <td><a href="#" onclick="inedit()" style="text-decoration:none"><%= tasktodo.name %></a></td> 
     <td><%= tasktodo.tname %></td> 
     <td><%=l tasktodo.created_at %></td> 
     <td> 
</div> 

<%= link_to t('.edit', :default => t("helpers.links.edit")), 
         edit_tasktodo_path(tasktodo), :class => 'btn btn-mini' %> 

입니다 나는 클릭했다. 모든 작업은 동일한 페이지에서만 수행해야합니다. Ajax를 사용하여 어떻게이 작업을 수행 할 수 있습니까?

+0

도움 (아약스)

희망의 RoR 및 JQuery와 사용하여 CRUD의 scaffhold을 구축 할 수 있습니다 인라인 편집 (inline editing)을 통해 달성하거나 인덱스 페이지에서 편집 양식 부분을 가져 와서 거기에서 업데이트하십시오. – VenkatK

+0

오픈 대답 질문입니다, 이것을 수행하는 다양한 접근법이 있습니다. –

답변