Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. # == Schema Information
  2. #
  3. # Table name: cars
  4. #
  5. # id :bigint(8) not null, primary key
  6. # year :integer
  7. # type :string(255)
  8. #
  9. class Car < ApplicationRecord
  10. def type
  11. return self[:type] if self[:type].present?
  12. year > 2010 ? 'new' : 'old'
  13. end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement