Sha256: c5a7906c70248c7ccb73466b48bc98359b3901c8f263695e5df1e9f0df73eb9e

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

def insert_user  
  # Path to words
  Haddock::Password.diction = Rails.root.join("config", "words")
  
  # User
  User.truncate_table
  Role.truncate_table
  password = Haddock::Password.generate
  
  admin = User.new(:name=>'Administrator', :email=>'dev@aimbulance.com',
                   :password=>password, :password_confirmation=>password)
  #admin.login = 'admin'
  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

2 entries across 2 versions & 1 rubygems

Version Path
freeberry-0.3.0 lib/generators/freeberry/base/templates/config/seeds.rb
freeberry-0.2.9 lib/generators/freeberry/base/templates/config/seeds.rb