2010-03-30 1 views
0

프로토 타입 헬퍼 메소드 "replace_html"을 사용하여 탭 인터페이스를 만들려고합니다. 나는 내가 일하는 세 가지 부분을 가지고있다. 첫 번째 탭은 '기본 탭'이며 자동으로로드됩니다.RoR : 부분 및 콜렉션이 작동하지 않는 Replace_html

<div id = "grid"> 
    <% things_today = things.find_things_today %> 
    <%= render :partial => "/todaything", :collection => things_today, :as =>:thing %> 
</div> 

... 잘 작동합니다. 이와 유사하게, 그래서 같이 div에 '그리드'의 내용을 대체 할 이는 _tomorrowthing 부분이 :이 탭 아무것도 클릭하면 모든 일이

<%things_tomorrow = things.find_things_tomorrow%> 
<%= link_to_function('Tomorrow',nil, :id=>'tab') do |page| 
    page.replace_html 'grid' , :partial => '/tomorrowthing',:collection => things_tomorrow, :as => :thing 
end %> 

. 방화 광구를 사용하면 발견 된 유일한 오류는 missing) after argument list이며 link_to_function이 호출 된 Element.update 블록에 포함되어 있습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

답변

0

이봐 잭은 내가 같은를 재현하려고하지만 난 내가 전에하지만 다음 코드는 같은 당신이

def things 
@things= (params[:id]=="today")? things.find_things_today : things.find_things_tomorrow 


render :update do |page| 
page.replace_html 'grid', :partial => (params[:id]=="today")? "/todaything" : '/tomorrowthing' , :objects=> @things 
end 
+0

좋아 컨트롤러

<%= link_to_remote "Today Thing", :url=>{:action=>"things", :id=>'today'}%> <%= link_to_remote "Tomorrow Thing", :url=>{:action=>"things", :id=>'tomorrow'}%> <div id = "grid"> <% @things = things.find_things_today %> <%= render :partial => "/todaything", :collection => @things %> </div> 

을 원하는 달성하는 데 도움이 될 수 link_to_function을 사용한 적이 없습니다 그렇습니다. 그러나 다른 방법이 있습니까? 누구도 프로토 타입 도우미가 작동하지 않는 이유를 알고 있습니까? 나는 이것을 며칠 더 열어 둘 것이다. 솔일 감사합니다. – JackCA

+1

며칠입니까? 그 거의 2 년이었다! !! –

관련 문제