服务器上的Angular / Rails $ resource params

时间:2015-01-08 08:47:31

标签: ruby-on-rails angularjs

有以下代码:

  $scope.event = new Event({ start_time: new Date(), animator_ids: [0] })
  $scope.event.start_time.setHours(0, 0, 0, 0)

  $scope.createEvent = ->
    $scope.event.animator_ids = [1, 2, 3]
    $scope.buttonText = "Saving..."
    $scope.event.$save ->
      $state.go('events.all')

和Rails服务器代码:

  def create
    render json: params and return
  end

JSON回复:

{"start_time":"2015-01-07T21:00:00.000Z","animator_ids":[1,2,3],"title":"1","description":"2","format":"json","action":"create","controller":"events","event":{"title":"1","description":"2","start_time":"2015-01-07T21:00:00.000Z"}}

我不明白为什么' start_time'在'事件'小组,但' animator_ids'不是!!我需要移动animator_ids'对同一组,我该怎么办?谢谢!

0 个答案:

没有答案