Adds sponsor model

This commit is contained in:
Gopesh Tulsyan 2014-06-05 17:51:22 +05:30
parent 411deb4c65
commit e38a654af1
6 changed files with 58 additions and 0 deletions

View file

@ -33,6 +33,7 @@ class Conference < ActiveRecord::Base
has_many :vpositions, :dependent => :destroy
has_many :vchoices, :dependent => :destroy
has_many :sponsorship_levels, dependent: :destroy
has_many :sponsors, dependent: :destroy
belongs_to :venue

12
app/models/sponsor.rb Normal file
View file

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

View file

@ -2,4 +2,5 @@ class SponsorshipLevel < ActiveRecord::Base
attr_accessible :title
validates_presence_of :title
belongs_to :conference
has_many :sponsors
end