diff --git a/lib/tracker_api/resources/story.rb b/lib/tracker_api/resources/story.rb index 3e1ebad..c34f41f 100644 --- a/lib/tracker_api/resources/story.rb +++ b/lib/tracker_api/resources/story.rb @@ -54,6 +54,7 @@ class UpdateRepresenter < Representable::Decorator property :deadline property :requested_by_id property :owner_ids, if: ->(_) { !owner_ids.blank? } + property :project_id # Use render_empty: false to address: https://github.com/dashofcode/tracker_api/issues/110 # - The default value of the labels attribute in Resources::Story is an empty array. @@ -165,6 +166,17 @@ def transitions(params = {}) end end + # Returns the story's original ("undirtied") project_id + # + # @return Integer + def project_id + if dirty_attributes.key?(:project_id) + original_attributes[:project_id] + else + @project_id + end + end + # @param [Hash] params attributes to create the task with # @return [Task] newly created Task def create_task(params)