Skip to content
This repository
tree: 45e9b76758
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (23 sloc) 0.635 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
class InsertProfileOfUser < ActiveRecord::Migration
  def self.up
    User.find(:all).each do |user|
      if defined?(Profile)
        if user.profile.nil?
          user.profile = Profile.new
          user.profile.font_size = F2P::Config.font_size
          user.profile.entries_in_page = F2P::Config.entries_in_page
          user.profile.text_folding_size = F2P::Config.text_folding_size
          raise unless user.profile.save
        end
      end
    end
  end

  def self.down
    User.find(:all).each do |user|
      if defined?(Profile)
        user.profile = nil
        raise unless user.save
      end
    end
  end
end
Something went wrong with that request. Please try again.