Sha256: b01e3322830ddf52ff4a89e1edb3ecb91e82923df4bcc8a50722ba9f71636836

Contents?: true

Size: 1022 Bytes

Versions: 5

Compression:

Stored size: 1022 Bytes

Contents

def insert_user  
  User.truncate_table
  Role.truncate_table
  password = Rails.env.production? ? Devise.friendly_token : (1..9).to_a.join
  
  admin = User.new(:name=>'Administrator', :email=>'dev@aimbulance.com',
                   :password=>password, :password_confirmation=>password)
  admin.login = 'admin' if admin.respond_to?(:login)
  admin.roles.build(:role_type => RoleType.admin)
  admin.skip_confirmation!
  admin.save!

  puts "Admin: #{admin.email}, #{admin.password}"
end

def insert_structures
  Structure.truncate_table
  
  main_page = Structure.create!(:title => "Главная страница", :slug => "main-page", :structure_type => StructureType.main, :parent => nil)
  #Structure.create!(:title => "Трансляции", :slug => "broadcasts", :structure_type => StructureType.broadcasts, :parent => main_page)
  #Structure.create!(:title => "Прямые репортажи", :slug => "posts", :structure_type => StructureType.posts, :parent => main_page)
end

insert_user
insert_structures

Version data entries

5 entries across 3 versions & 1 rubygems

Version Path
sunrise-core-0.2.2 lib/generators/sunrise/templates/config/seeds.rb
sunrise-core-0.2.1 lib/generators/sunrise/templates/config/seeds.rb
sunrise-core-0.2.1 spec/tmp/db/seeds.rb
sunrise-core-0.2.0 lib/generators/sunrise/templates/config/seeds.rb
sunrise-core-0.2.0 spec/tmp/db/seeds.rb