我想要在軌數據庫中獲取的數據,這是我的控制器文件軌500內部服務器錯誤
class PathsController < ApplicationController
before_filter :authenticate_user!
skip_before_filter :verify_authenticity_token
def getall
@result = Path.select('x', 'y')
end
respond_to do |format|
format.json { render json: @result }
end
end
這裏是我的js函數
function makelines()
{
$.ajax({
type: "GET",// => method type
url: "/path", // => Target function that will be return result
contentType:"application/json",
success: function(result){
result = JSON.parse(result);
console.log(result);
}
});
}
這裏是路線
match '/path => 'Paths#getall', via: [:get, :post], :default => { :format => 'json' }
你能否提供更多關於錯誤的細節? –