File: automobile.rb

package info (click to toggle)
rails 2%3A4.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 21,580 kB
  • sloc: ruby: 172,699; sql: 43; yacc: 43; sh: 14; makefile: 12
file content (13 lines) | stat: -rw-r--r-- 284 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
class Automobile
  include ActiveModel::Validations

  validate :validations

  attr_accessor :make, :model, :approved

  def validations
    validates_presence_of :make
    validates_length_of   :model, within: 2..10
    validates_acceptance_of :approved, allow_nil: false
  end
end