Sha256: 84516eb0325ce03964debdc24dbe884cd5a02e4ed673847e2227c1c6b59aa178

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

# Use the default
apply File.expand_path("../rails_template.rb", __FILE__)

# Register Active Admin controllers
%w{ Post User Category }.each do |type|
  generate :'active_admin:resource', type
end

# Setup some default data
append_file "db/seeds.rb", <<-EOF
  users = ["Jimi Hendrix", "Jimmy Page", "Yngwie Malmsteen", "Eric Clapton", "Kirk Hammett"].collect do |name|
    first, last = name.split(" ")
    User.create!  :first_name => first,
                  :last_name => last,
                  :username => [first,last].join('-').downcase,
                  :age => rand(80)
  end

  categories = ["Rock", "Pop Rock", "Alt-Country", "Blues", "Dub-Step"].collect do |name|
    Category.create! :name => name
  end

  1_000.times do |i|
    user = users[i % users.size]
    cat = categories[i % categories.size]
    Post.create :title => "Blog Post \#{i}",
                :body => "Blog post \#{i} is written by \#{user.username} about \#{cat.name}",
                :category => cat,
                :author => user
  end
EOF

rake 'db:seed'

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
andrewroth_activeadmin-0.3.4.4 spec/support/rails_template_with_data.rb
andrewroth_activeadmin-0.3.4.3 spec/support/rails_template_with_data.rb
andrewroth_activeadmin-0.3.4.2 spec/support/rails_template_with_data.rb
andrewroth_activeadmin-0.3.4.1 spec/support/rails_template_with_data.rb
andrewroth_activeadmin-0.3.4 spec/support/rails_template_with_data.rb
activeadmin-0.3.4 spec/support/rails_template_with_data.rb
activeadmin-0.3.3 spec/support/rails_template_with_data.rb
activeadmin-0.3.2 spec/support/rails_template_with_data.rb
activeadmin-0.3.1 spec/support/rails_template_with_data.rb
activeadmin-0.3.0 spec/support/rails_template_with_data.rb
nsm-activeadmin-0.2.2 spec/support/rails_template_with_data.rb