will_paginate 또는 kaminari를 사용하여 Ajax로 작업하는 페이지 매김을 얻으려고합니다. 나는 매김 내 로그를 연결 히트js.erb는 자바 스크립트를 실행하지 않지만 레일을 처리합니다
는Processing by Instructor::FullDashboardController#pupil_leads as JS
및
Rendered instructor/full_dashboard/pupil_leads.js.erb within layouts/main (0.1ms)
을 말한다 그러나 JS는 효과가 없습니다. 그래서 그것을 테스트 나는 예상대로
This is the js file
를 볼 수 있지만, 거기에 JS 콘솔 아무것도 브라우저에없고 경고가 표시되지 않습니다 내 로그에서 js.erb 파일에서
console.log("Hello");
<%logger.debug "This is the js file"%>
alert('Hello Rails');
을 썼다. 그래서 나는 logger.debug가 작동하지만 js가 없으므로 파일이 처리되고 있다는 것을 알고있다.
이 문제를 어떻게 해결할 수 있습니까?
레일 4.1
루비 2.1
전체 대시 렌더링 블록에 layout: false
옵션을 추가
class Instructor::FullDashboardController < ApplicationController
layout 'main'
...
def pupil_leads
@ivar = Model.where("something = ?", some_object.id).order("created_at desc").page(params[:page]).per(10)
respond_to do |f|
f.js { render :content_type => 'text/javascript' }
f.html
end
end
전체 강사 :: FullDashboardController 표시하십시오. –
조금 길어서 관련 조치를 원하십니까? – LpLrich
'pupil_leads'조치를 게시하십시오. –