This commit is contained in:
Gopesh Tulsyan 2014-06-11 10:18:52 +00:00
commit 6903a0b7c1
11 changed files with 115 additions and 12 deletions

View file

@ -10,7 +10,8 @@ class Conference < ActiveRecord::Base
:difficulty_levels_attributes, :use_difficulty_levels,
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
:media_id, :media_type, :color, :description,
:registration_description, :ticket_description
:registration_description, :ticket_description,
:photos_attributes
has_paper_trail
@ -31,7 +32,7 @@ class Conference < ActiveRecord::Base
has_many :vdays, :dependent => :destroy
has_many :vpositions, :dependent => :destroy
has_many :vchoices, :dependent => :destroy
has_many :photos, dependent: :destroy
belongs_to :venue
accepts_nested_attributes_for :rooms, :reject_if => proc {|r| r["name"].blank?}, :allow_destroy => true
@ -46,6 +47,7 @@ class Conference < ActiveRecord::Base
accepts_nested_attributes_for :questions, :allow_destroy => true
accepts_nested_attributes_for :vdays, :allow_destroy => true
accepts_nested_attributes_for :vpositions, :allow_destroy => true
accepts_nested_attributes_for :photos, allow_destroy: true
has_attached_file :logo,
:styles => {:thumb => "100x100>", :large => "300x300>" }

11
app/models/photo.rb Normal file
View file

@ -0,0 +1,11 @@
class Photo < ActiveRecord::Base
attr_accessible :picture, :description
belongs_to :conference
validates_presence_of :picture
has_attached_file :picture,
styles: { thumb: '100x100>', large: '300x300>' }
validates_attachment_content_type :picture,
content_type: [/jpg/, /jpeg/, /png/, /gif/],
size: { in: 0..500.kilobytes }
end