· 1 min read
Screencast: Administrationsfläche über Active Admin
Downloads in verschiedenen Formaten:
Resourcen:
bash
[bash] bundle rails g active_admin:install rake db:migrate rails g active_admin:resource product [/bash]
Gemfile
[ruby] gem ‘activeadmin’ [/ruby]
app/admin/products.rb
[ruby] ActiveAdmin.register Product do scope :unreleased index do column :name column :category column “Release Date”, :released_at column :price, :sortable => :price do |product| div :class => “price” do number_to_currency product.price end end default_actions end end [/ruby]
app/admin/dashboards.rb
[ruby] ActiveAdmin::Dashboards.build do section “Recent Products” do table_for Product.order(“released_at desc”).limit(5) do column :name do |product| link_to product.name, [:admin, product] end column :released_at end strong { link_to “View All Products”, admin_products_path } end end [/ruby]
app/assets/stylesheets/application.css.scss
[css] @import “products”; [/css]
config/initializers/active_admin.rb
[ruby] config.site_title = “Ryan’s Store” [/ruby]