Implements Contacts

This commit is contained in:
Henne Vogelsang 2014-07-31 18:49:46 +02:00
parent 4955b2b7b8
commit eb3e6898d2
9 changed files with 156 additions and 5 deletions

View file

@ -27,6 +27,8 @@ class Conference < ActiveRecord::Base
has_and_belongs_to_many :questions
has_one :contact, dependent: :destroy
has_one :email_settings, dependent: :destroy
has_one :call_for_papers, dependent: :destroy
has_many :social_events, dependent: :destroy
@ -523,6 +525,10 @@ class Conference < ActiveRecord::Base
private
after_create do
self.create_contact
end
##
# Calculates the weeks from a start and a end week.
#

8
app/models/contact.rb Normal file
View file

@ -0,0 +1,8 @@
class Contact < ActiveRecord::Base
attr_accessible :conference, :social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public
belongs_to :conference
validates :conference, presence: true
# Conferences only have one contact
validates :conference_id, :uniqueness => {:message => "has already contact details"}
end