Added lodging backend
This commit is contained in:
parent
b1c171cd97
commit
4cc039b358
13 changed files with 164 additions and 1 deletions
10
app/models/lodging.rb
Normal file
10
app/models/lodging.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class Lodging < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :photo
|
||||
belongs_to :venue
|
||||
has_attached_file :photo,
|
||||
styles: { thumb: '100x100>', large: '300x300>' }
|
||||
|
||||
validates_attachment_content_type :photo,
|
||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
||||
size: { in: 0..500.kilobytes }
|
||||
end
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
class Venue < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :website, :address, :photo
|
||||
attr_accessible :name, :description, :website, :address, :photo, :lodgings_attributes
|
||||
has_many :conferences
|
||||
has_many :lodgings
|
||||
before_create :generate_guid
|
||||
has_attached_file :photo,
|
||||
styles: { thumb: '100x100>', large: '300x300>' }
|
||||
|
|
@ -8,6 +9,8 @@ class Venue < ActiveRecord::Base
|
|||
validates_attachment_content_type :photo,
|
||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
||||
size: { in: 0..500.kilobytes }
|
||||
accepts_nested_attributes_for :lodgings, reject_if: proc { |r| r['name'].blank? },
|
||||
allow_destroy: true
|
||||
private
|
||||
|
||||
def generate_guid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue