Last active
August 29, 2015 14:10
-
-
Save rentes/61810aaed8c71955bd0c to your computer and use it in GitHub Desktop.
How to get all "issues from" or "issues to" a particular issue (passed on parameter)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_issues_relations_from_issue(issue) | |
relations = IssueRelation.find(:all, :include => [ :issue_from, :issue_to ], | |
:conditions => [ 'issue_from_id = ' + issue.id.to_s + ' or issue_to_id = ' + issue.id.to_s]) | |
relations.each do |relation| | |
if relation.issue_from_id == issue.id | |
puts "From issue" + issue.id.to_s + " -> " + issue.id.to_s + " " + relation.relation_type + " " + relation.issue_to_id.to_s | |
elsif relation.issue_to_id == issue.id | |
puts "To issue " + issue.id.to_s + " -> " + relation.issue_from_id.to_s + " " + relation.relation_type + " " + issue.id.to_s | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment