我是新来的,我被堆积了。我尝试使用日历做用户。当每个模型分开时,每个模型都工作良好,现在我将其连接并堆叠在一起。我正在为用户和fullCalendar gem使用gem dev。

这是我的js日历文件

$(document).ready ->
  $("#calendar").fullCalendar(

    events: "profile.#{window.user_id}/events.json"
  )


使用cal查看我的用户个人资料

    <h1>Your events</h1>

<div id='calendar'></div> </div>
<script>
window.user_id = <%= user_signed_in? && current_user.id %>;
</script>


我的json文件

json.array!(@events) do |event|
  json.extract! event, :id, :name
  json.start event.start_time
  json.end event.end_time
  json.url event_url(event, format: :html)
end


问题出在Javascript中。错误消息是:

GET http://localhost:3000/persons/profile.1/events.json?start=2015-04-26&end=2015-06-07&_=1432462639832 404 (Not Found)


有人可以告诉我我在做什么错吗?谢谢阅读 :)

最佳答案

我认为您的网址有误。似乎您使用点而不是斜杠:

profile.1/events.json


尝试将.替换为/

仅供参考:尝试使用rake routes命令找到正确的操作路径。

10-05 20:37
查看更多