Project

General

Profile

Download (463 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman-docker / app / models / docker_parameter.rb @ c69bcf98

1
class DockerParameter < ActiveRecord::Base
2
  extend FriendlyId
3
  friendly_id :key
4
  include Parameterizable::ByIdName
5

    
6
  validates_lengths_from_database
7

    
8
  include Authorizable
9
  validates :key, :presence => true, :no_whitespace => true
10

    
11
  scoped_search :on => :key, :complete_value => true
12

    
13
  default_scope -> { order("docker_parameters.key") }
14

    
15
  before_validation :strip_whitespaces
16

    
17
  def strip_whitespaces
18
    self.value.strip! unless value.blank?
19
  end
20
end