lib/redmine_rest/models/issue.rb in redmine_rest-0.6.1 vs lib/redmine_rest/models/issue.rb in redmine_rest-0.7.0
- old
+ new
@@ -3,10 +3,11 @@
require_relative 'user'
require_relative 'project'
require_relative 'version'
require_relative 'relation'
require_relative 'tracker'
+require_relative 'attachment'
require_relative 'collections/issue'
module RedmineRest
module Models
#
@@ -18,15 +19,16 @@
has_one :tracker, class_name: Tracker
has_one :author, class_name: User
has_one :assigned_to, class_name: User
has_one :project, class_name: Project
- has_one :version, class_name: Version
+ has_one :fixed_version, class_name: Version
has_one :parent, class_name: Issue
has_many :children, class_name: Issue
has_many :watchers, class_name: User
has_many :relations, class_name: Relation
+ has_many :attachments, class_name: Attachment
validates :subject, :tracker_id, presence: true
def tracker_id
attributes[:tracker_id] || tracker? && tracker.id
@@ -41,12 +43,12 @@
def self.find(what, options = {})
options[:params] = {} unless options[:params]
params = options[:params]
if params[:include]
- params[:include] += ',journals,relations,children,watchers'
+ params[:include] += ',journals,relations,children,watchers,attachments'
else # doubling is not bad
- params[:include] = 'journals,relations,children,watchers'
+ params[:include] = 'journals,relations,children,watchers,attachments'
end
super(what, options)
end