Guest User

Untitled

a guest
Jun 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. class Reservation < ActiveRecord::Base
  2. belongs_to :cabin_type
  3. has_many :people
  4.  
  5. def new
  6. raise "cabin type required" if cabin_type.nil?
  7. cabin_type.capacity.times do
  8. self.people << Person.new
  9. end
  10. end
  11.  
  12. end
Add Comment
Please, Sign In to add comment