0
HAML을이 간단한 부분을 알아낼 수 없습니다처음부터 처음으로 JSON에서 작업하고 난
= link_to 'redeem', redeem_admin_organization_path(organization), :class => 'button_short live redeem'
컨트롤러 :
def redeem
@organization = Organization.find(params[:id])
@organization.update_attribute('accumulated_credits', '0')
end
redeem.js.haml :
== $("#organization_#{@organization.id} .redeem").html("#{escape_javascript(link_to('redeem', redeem_admin_organization_path(@organization), :class => 'button_short live redeem'))}");
오류가 반환됩니다.
NoMethodError (undefined method `accumulated_credits=' for #<Organization:0x2f3242c>):
아하을 확인할 수 있습니다 존재하지 않는 것처럼 보인다! IRB에서 Organization.first.accumulated_credits (0을 반환)와 같은 데이터 만 검색 할 수 있습니다. 하지만 Organization.first.update_attribute ('accumulation_credit', '0')를 수행하면 위와 같은 오류가 발생합니다. 그게 무슨 뜻 이죠? – Trip
알았어요. 이 속성이이 모델에 첨부되지 않았기 때문입니다. 따라서 문제 : D 그러나 당신의 포인터는 그것을 알아낼 수있게했습니다. 감사 – Trip