diff --git a/app/models/event.rb b/app/models/event.rb index ecf9973..2d86869 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -29,6 +29,10 @@ class Event < ActiveRecord::Base proposer.personal_profile(conference) end + def length + read_attribute(:length) || event_type.try(:minimum_length) + end + private def track_belongs_to_the_selected_conference diff --git a/db/migrate/20150819213202_drop_default_value_for_length_in_events.rb b/db/migrate/20150819213202_drop_default_value_for_length_in_events.rb new file mode 100644 index 0000000..df70401 --- /dev/null +++ b/db/migrate/20150819213202_drop_default_value_for_length_in_events.rb @@ -0,0 +1,5 @@ +class DropDefaultValueForLengthInEvents < ActiveRecord::Migration + def change + change_column_default(:events, :length, nil) + end +end