add highlights and fix cfp in splashpage
This commit is contained in:
parent
8e25338436
commit
ecfc348ea8
17 changed files with 111 additions and 32 deletions
5
db/migrate/20141127161313_add_is_highlight_in_events.rb
Normal file
5
db/migrate/20141127161313_add_is_highlight_in_events.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddIsHighlightInEvents < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :events, :is_highlight, :boolean, default: false
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
class MigrateDataRemoveColumnIncludeCfpInSplashAddColumnIncludeCfp < ActiveRecord::Migration
|
||||
class TempConference < ActiveRecord::Base
|
||||
self.table_name = 'conferences'
|
||||
end
|
||||
|
||||
class TempCallForPaper< ActiveRecord::Base
|
||||
self.table_name = 'call_for_papers'
|
||||
end
|
||||
|
||||
class TempSplashpage < ActiveRecord::Base
|
||||
self.table_name = 'splashpages'
|
||||
attr_accessible :conference_id
|
||||
end
|
||||
|
||||
def up
|
||||
add_column :splashpages, :include_cfp, :boolean, default: false
|
||||
|
||||
TempConference.all.each do |conference|
|
||||
cfp = TempCallForPaper.find_by(conference_id: conference.id)
|
||||
|
||||
if cfp && cfp.include_cfp_in_splash
|
||||
splashpage = TempSplashpage.find_or_initialize_by(conference_id: conference.id)
|
||||
splashpage.include_cfp = cfp.include_cfp_in_splash # true
|
||||
splashpage.save!
|
||||
end
|
||||
end
|
||||
|
||||
remove_column :call_for_papers, :include_cfp_in_splash, :boolean, default: false
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :call_for_papers, :include_cfp_in_splash, :boolean, default: false
|
||||
|
||||
TempConference.all.each do |conference|
|
||||
splashpage = TempSplashpage.find_by(conference_id: conference.id)
|
||||
cfp = TempCallForPaper.find_by(conference_id: conference.id)
|
||||
|
||||
if splashpage && cfp
|
||||
cfp.include_cfp_in_splash = splashpage.include_cfp
|
||||
cfp.save!
|
||||
end
|
||||
end
|
||||
|
||||
remove_column :splashpages, :include_cfp, :boolean, default: false
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue