Error about actions not being present when invoking trigger update #86

Closed
benilovj opened this Issue May 3, 2013 · 2 comments

Projects

None yet

2 participants

@benilovj
Contributor
benilovj commented May 3, 2013

When executing the following code using the 0.3.5 gem:

trigger = client.triggers.find(id: 12345) # the found trigger has actions
trigger.conditions.any.first.value = "abcde"
trigger.save

I get the following error:

W, [2013-05-03T11:35:23.126733 #6638]  WARN -- : the server responded with status 422
W, [2013-05-03T11:35:23.126835 #6638]  WARN -- : /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response/raise_error.rb:8:in `on_complete'
W, [2013-05-03T11:35:23.127217 #6638]  WARN -- :    {"error"=>"RecordInvalid", "description"=>"Record validation errors", "details"=>{"base"=>[{"description"=>"Trigger must contain at least one action"}]}}

even though the original trigger did in fact define actions. Am I doing something wrong?

@steved
Contributor
steved commented May 7, 2013

Rule (views, macros, triggers, automations) update requests require the full payload. This should be fixed with b185f15, for now a workaround would be:

trigger = client.triggers.find(id: 12345) # the found trigger has actions
trigger.conditions.any.first.value = "abcde"
trigger.attributes.changes.replace(trigger.attributes)
trigger.save
@steved
Contributor
steved commented Jun 10, 2013

Closing if there are no further problems.

@steved steved closed this Jun 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment