Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # == Schema Information
- #
- # Table name: cars
- #
- # id :bigint(8) not null, primary key
- # year :integer
- # type :string(255)
- #
- class Car < ApplicationRecord
- def type
- return self[:type] if self[:type].present?
- year > 2010 ? 'new' : 'old'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement