Top Level Namespace

Defined Under Namespace

Modules: AbAdmin, ActiveModel, ControllerMacros, Globalize, GlobalizeAccessorsWithLocaleSuffix, GlobalizeFixResetAttribute, MailerMacros, WillPaginate Classes: Ability, AdminComment, AdminMenu, Array, Asset, AttachmentFile, AttachmentFileUploader, Avatar, AvatarUploader, Dashboard, Date, FalseClass, GenderType, Hash, Header, Locator, NilClass, Object, Picture, PictureUploader, PositionType, Settings, StaticPage, StaticPageType, String, Structure, StructureType, Time, Track, TrueClass, User, UserRoleType

Instance Method Summary collapse

Instance Method Details

#all_uploadersObject


1
2
3
4
5
6
# File 'lib/generators/ab_admin/install/templates/spec/support/carrierwave.rb', line 1

def all_uploaders
  @all_uploaders ||= begin
    Dir[Rails.root.join('app/uploaders/*.rb')].each { |u| require u }
    AbAdmin::CarrierWave::BaseUploader.subclasses
  end
end

#disable_processingObject


14
15
16
17
18
# File 'lib/generators/ab_admin/install/templates/spec/support/carrierwave.rb', line 14

def disable_processing
  all_uploaders.each do |u|
    u.enable_processing = false
  end
end

#enable_processingObject


8
9
10
11
12
# File 'lib/generators/ab_admin/install/templates/spec/support/carrierwave.rb', line 8

def enable_processing
  all_uploaders.each do |u|
    u.enable_processing = true
  end
end

#insert_structuresObject


18
19
20
21
22
# File 'lib/generators/ab_admin/install/templates/config/seeds.rb', line 18

def insert_structures
  Structure.truncate!

  main_page = Structure.create!({title: 'Главная страница', slug: 'main-page', structure_type: StructureType.main, parent: nil}, as: :admin)
end

#insert_userObject


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

def insert_user
  User.truncate!
  password = Rails.env.production? ? Devise.friendly_token : (1..8).to_a.join

  admin = User.new do |u|
    u.email = '[email protected]'
    u.password = password
    u.password_confirmation = password
    u.user_role_id = UserRoleType.admin.id
  end

  admin.activate!
  admin.save!

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