私はレール内のデータベースからデータを取得しようとしている、これは私のコントローラファイルであるレール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' }
エラーについての詳細を教えてください。 –