class Object

Public Instance Methods

new_profile() click to toggle source

unless solr = Sunspot.commit rescue nil

raise "Solr is not running."

end

# File lib/generators/enju_leaf/setup/templates/db/seeds.rb, line 12
def new_profile
  profile = Profile.new
  profile.user_group = UserGroup.first
  profile.library = Library.real.first
  profile.locale = I18n.default_locale.to_s
  profile
end
update_profile() click to toggle source
# File lib/tasks/profile.rb, line 1
def update_profile
  User.find_each do |user|
    next if user.profile
    profile = Profile.new
    profile.user = user
    profile.user_group = user.user_group
    profile.library = user.library
    profile.required_role = user.required_role
    profile.user_number = user.user_number
    profile.keyword_list = user.keyword_list
    profile.locale = user.locale
    profile.note = user.note
    profile.save!
  end
end