Rooms belong to venue

This commit is contained in:
Stella Rouzi 2015-11-07 11:43:36 +02:00 committed by Henne Vogelsang
parent feabbfbc99
commit f840f2b3f0
31 changed files with 221 additions and 166 deletions

View file

@ -1,9 +1,10 @@
class Venue < ActiveRecord::Base
belongs_to :conference
has_many :lodgings
has_many :rooms, dependent: :destroy
before_create :generate_guid
validates :name, :street, :city, :country, presence: true
validates :conference_id, presence: true, uniqueness: true
has_attached_file :photo,
styles: { thumb: '100x100>', large: '300x300>' }
@ -11,8 +12,6 @@ class Venue < ActiveRecord::Base
content_type: [/jpg/, /jpeg/, /png/, /gif/],
size: { in: 0..500.kilobytes }
accepts_nested_attributes_for :lodgings, allow_destroy: true
after_update :send_mail_notification
def address