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_structures ⇒ Object
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)
end
|
#insert_user ⇒ Object
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.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
|