app/models/project.rb
# returns the doc added to the project
# returns nil if nothing is added
returns the doc added to the project
returns nil if nothing is added
returns the doc added to the project returns nil if nothing is added
def add_doc(sourcedb, sourceid)
		doc = Doc.find_by_sourcedb_and_sourceid(sourcedb, sourceid)
		unless doc.present?
			new_docs, messages = Doc.sequence_and_store_docs(sourcedb, [sourceid])
			unless new_docs.present?
				message = messages.map do |m|
					if m.class == Hash
						m[:body]
					else
						m
					end
				end.join("\n")
				raise RuntimeError, "Failed to get the document: #{message}"
			end
			doc = new_docs.first
		end
		return nil if self.docs.include?(doc)
		doc.projects << self
		doc
	end
def add_doc ( sourcedb , sourceid ) doc = Doc . find_by_sourcedb_and_sourceid ( sourcedb , sourceid ) unless doc . present? new_docs , messages = Doc . sequence_and_store_docs ( sourcedb , [ sourceid ] ) unless new_docs . present? message = messages . map do | m | if m . class == Hash m [ :body ] else m end end . join ( "\n" ) raise RuntimeError , "Failed to get the document: #{message}" end doc = new_docs . first end return nil if self . docs . include? ( doc ) doc . projects << self doc end
returns the doc added to the project
returns nil if nothing is added
returns the doc added to the project returns nil if nothing is added
sourcedb
<not_specific>
sourceid
<not_specific>