mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-22 00:36:12 +01:00
Fix #1223 for the single tag and single dependency case in the REST API
This commit is contained in:
parent
eb2f071c80
commit
960326efb4
3 changed files with 48 additions and 23 deletions
|
|
@ -1518,10 +1518,12 @@ class TodosController < ApplicationController
|
|||
@attributes = params['request'] && params['request']['todo'] || params['todo']
|
||||
|
||||
if @attributes && @attributes[:tags]
|
||||
# for single tags, @attributed[:tags] returns a hash. For multiple tags,
|
||||
# it with return an array of hashes. Make sure it is always an array of hashes
|
||||
@attributes[:tags][:tag] = [@attributes[:tags][:tag]] unless @attributes[:tags][:tag].class == Array
|
||||
# the REST api may use <tags> which will collide with tags association, so rename tags to add_tags
|
||||
add_tags = @attributes[:tags]
|
||||
@attributes[:add_tags] = @attributes[:tags]
|
||||
@attributes.delete :tags
|
||||
@attributes[:add_tags] = add_tags
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue