2011-01-18 2 views
1

WebORB에서 Warhammerkids Rails3-amf로 변경 중입니다. 이러한 문제 중 하나는 연관에서 배열로 레코드를 가져와 Flex 어플리케이션으로 다시 보낼 수 있다는 것입니다. 나는 비슷한 구조가 Rails3-AMF의Rails3-amf 및 amf에 대한 제휴 가져 오기

def getClients(clientFilter,myMandant) 
    clients = Client.find(:all, :conditions => {:account_id => myMandant}, :include => [:addresses, :contacts, :proofs]) 
    end 

: 내가 배열로 다시 모두 올바르게 입력 클라이언트 개체를 얻을이 코드

def getClients() 
    @clients = Client.find(:all, :conditions => {:account_id => params[1]}, :include => [:addresses, :contacts, :proofs]) 
    respond_with(@clients) do |format| 
     format.amf { render :amf => @clients} 
    end 

을, 같은 은 WebORB에서 컨트롤러의 방법은 보인다 그러나 ": include"인수의 레코드는 없습니다. 어떻게 처리 할 수 ​​있습니까 ?? 나는 오류 메시지 "#에 대한 정의되지 않은 방법 to_amf있어이 시도로

.... 
respond_with(@clients) do |format| 
     format.amf { render :amf => @clients.to_amf(:include => [:addresses, :contacts, :proofs])} 
.... 

덕분에 어떤 도움을

답변

1

그렇게하지 :

는 또한 또 다른 방법을 시도했다.. rail3-amf에 대해 알고 있지만 restfulx를 보면서 보람을 느낄 것입니다. - https://github.com/dima/restfulx/tree/rails3

레일 용 라이브러리와 f 용 라이브러리로 구성되어 있습니다. 법률. json, xml 또는 amf를 통한 데이터 전송을 지원합니다.

모델 작업을위한 액션 스크립트 API도 아주 좋은 :

var user:User = new User(); 
user.first_name = "Ed"; 
user.create(); 
또한 레일 협회 등 :

trace(user.account.title); 

여기에 더 사용을 참조하십시오 추적 유지할 수

-https://github.com/dima/restfulx_framework/wiki/Working-with-RestfulX-Models