Initial Rails4 Port

This commit is contained in:
Henne Vogelsang 2014-04-23 15:45:55 +02:00
parent 5923a66a88
commit 2e9b92c3af
19 changed files with 394 additions and 817 deletions

View file

@ -59,8 +59,7 @@ class Conference < ActiveRecord::Base
:start_date,
:end_date
validates_uniqueness_of :short_title
validates_format_of :short_title, :with => /^[a-zA-Z0-9_-]*$/
validates_format_of :short_title, :with => /\A[a-zA-Z0-9_-]*\z/
before_create :generate_guid
before_create :create_venue
before_create :create_email_settings

View file

@ -8,7 +8,7 @@ class Event < ActiveRecord::Base
has_many :event_people, :dependent => :destroy
has_many :event_attachments, :dependent => :destroy
has_many :people, :through => :event_people
has_many :speakers, :through => :event_people, :source => :person, :conditions => {"event_people.event_role" => "speaker"}
has_many :speakers, :through => :event_people, :source => :person
has_many :votes
has_many :voters, :through => :votes, :source => :person
belongs_to :event_type
@ -31,7 +31,7 @@ class Event < ActiveRecord::Base
validates :abstract, :presence => true
validates :media_type, :allow_nil => true, inclusion: {in: Conference.media_types.values}
scope :confirmed, where(:state => "confirmed")
scope :confirmed, -> { where(state: 'confirmed') }
state_machine :initial => :new do
state :new