diff options
| author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-25 08:37:49 +0100 |
|---|---|---|
| committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-03 10:41:11 +0100 |
| commit | 65ba4da925361e69f59fc87eaf908e933079f2c3 (patch) | |
| tree | b5c6c05c6b8562bd2c7aacdf08b1daf26687e7b6 /app/models/label.rb | |
| parent | 1fa7671f44291f78131c0fa31f6d1ffcb3ff6bbc (diff) | |
| download | gitlab-ce-65ba4da925361e69f59fc87eaf908e933079f2c3.tar.gz | |
Add support for keyword arguments in label reference method
Diffstat (limited to 'app/models/label.rb')
| -rw-r--r-- | app/models/label.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index c34f4e4ba60..02683a08dd6 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -66,16 +66,13 @@ class Label < ActiveRecord::Base # # format - Symbol format to use (default: :id, optional: :name) # - # Note that its argument differs from other objects implementing Referable. If - # a non-Symbol argument is given (such as a Project), it will default to :id. - # # Examples: # - # Label.first.to_reference # => "~1" - # Label.first.to_reference(:name) # => "~\"bug\"" + # Label.first.to_reference # => "~1" + # Label.first.to_reference(format: :name) # => "~\"bug\"" # # Returns a String - def to_reference(format = :id) + def to_reference(_from_project = nil, format: :id) if format == :name && !name.include?('"') %(#{self.class.reference_prefix}"#{name}") else |
