diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-08-10 18:07:50 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-08-10 18:25:15 -0400 |
commit | 775418918782d5284000ed0bfea364458c748567 (patch) | |
tree | c31e3633a3bcbed17b000f0165cf35edad41f7ca /app/models/key.rb | |
parent | 1413c23c502d5a5cbc9b81f553a245103c1d6e50 (diff) | |
download | gitlab-ce-775418918782d5284000ed0bfea364458c748567.tar.gz |
Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
Diffstat (limited to 'app/models/key.rb')
-rw-r--r-- | app/models/key.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/key.rb b/app/models/key.rb index 6b90b315d82..cfcb1f63c26 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -6,16 +6,16 @@ class Key < ActiveRecord::Base belongs_to :project validates :title, - :presence => true, - :length => { :within => 0..255 } + presence: true, + length: { within: 0..255 } validates :key, - :presence => true, - :length => { :within => 0..5000 } + presence: true, + length: { within: 0..5000 } before_save :set_identifier before_validation :strip_white_space - delegate :name, :email, :to => :user, :prefix => true + delegate :name, :email, to: :user, prefix: true validate :unique_key def strip_white_space @@ -23,7 +23,7 @@ class Key < ActiveRecord::Base end def unique_key - query = Key.where(:key => key) + query = Key.where(key: key) query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id if (query.count > 0) errors.add :key, 'already exist.' |