Top Level Namespace

Defined Under Namespace

Modules: ControllerMacros, I18n, SimpleForm, Sunrise Classes: Ability, Array, Asset, AttachmentFile, AttachmentFileUploader, Avatar, AvatarUploader, Header, Page, PageSweeper, PagesController, Picture, PictureUploader, PositionType, Role, RoleType, String, Structure, StructureSweeper, StructureType, SunriseCreateAssets, SunriseCreateHeaders, SunriseCreatePages, SunriseCreateRoles, SunriseCreateStructures, SunriseCreateUsers, User

Instance Method Summary collapse

Instance Method Details

#insert_structuresObject



16
17
18
19
20
21
22
# File 'lib/generators/sunrise/templates/config/seeds.rb', line 16

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_userObject



1
2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/sunrise/templates/config/seeds.rb', line 1

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=>'[email protected]',
                   :password=>password, :password_confirmation=>password)
  admin. = '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