와 자식 노드를 포함 부모와 자식 (의 고객을 말하고 차지하자) : class Customer < ActiveRecord::Base
has_many :accounts
end
를 고객에 대한 내 컨트롤러에서 나는 인덱스 및 편집 한 - 난 그냥 (계정없이) 모든 고객을 반환하려면 인덱스 및 편집 난을 반환 할 위치 특정 고객에게 모든 계정을 제
나는 안드로이드를 위해 그것을 구문 분석 rabl를 사용하여 JSON 형식으로 내 DB에서 데이터를 표시하고있어이 ... 내 JSON은 그래서 다음과 같습니다 [
{
"bank":{
"central_office_address":"ololo",
"license":"12312312",
"location_id"
rabl 템플릿의 렌더링이 실패 할 때마다 오류 만 표시됩니다. 줄 번호가 표시되지 않습니다. 아직이 문제에 직면 한 사람이 있습니까? 예 추적 : Rendered campaigns/show.json.rabl (1377.9ms)
undefined method `[]' for nil:NilClass
(eval):21:in `block (2 levels)
일부 json 데이터를 렌더링해야합니다. 이 JSON 나 생성의 collection @banks, :root => "bank", :object_root => false
attributes :id, :central_office_address, :location_id, :name, :year_of_foundation
.... 하지만 지금은 어떤 계산도 둘
Rails를 통해 REST를 통해 데이터에 액세스하려면 Rails를 사용하고 있습니다. if 문을 제외하고는 작동합니다. object @expense
attributes :id, :unitcost, :quantity, :markup, :exp_date, :created_at, :description, :pcard, :invoice
child :empl
나는 updated_at 특성의 datetime을 다른 형식이지만 컬렉션에 반환하려고합니다. 이 하나의 개체가 있었다면, 내가 할 것 object @person
attributes :name, :phone
node(:updated_at){|person|(person.created_on.strftime(%d,%m,%Y)}
end
그러나
에서 개체를 보내 브라우저에서 내 쇼 동작을 열면 내 도우미가 @exchanger 객체를 보냈습니다. 모두 괜찮습니다. 그러나! 내가 index 액션을 호출 할 때 내가 얻을 : 내가 @exchanger 객체를 도우미 인덱스 rabl보기를 사용하는 경우 모든 괜찮 데이터 Called id for nil, which would mistakenly be 4 -
시나리오 : 레일 + Mongoid + Rabl 나는 class User
has_many :cards
field :name
및 class Card
belongs_to :user
field :anotheruser, type:Moped::BSON::ObjectId
난 같은 수업을 rabl 초보 그래서 거기에 당신을