Steps to install Active Admin
1) Install Active Admin gem in your gem file
gem install 'activeadmin'
2) Rails g active_admin:install
3) rake db:migrate
4) rails g active_admin:resource product
5) write in product.rb
In your app/admin/ folder one file generate like 'product.rb'
path is = app/admin/product.rb
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
6) write in dashboards.rb
app/admin/dashboards.rb
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
7) write in application.css.scss
app/assets/stylesheets/application.css.scss
@import "products";
8) write in active_admin.rb
config/initializers/active_admin.rb
config.site_title = "Dipak's Store"
1) Install Active Admin gem in your gem file
gem install 'activeadmin'
2) Rails g active_admin:install
3) rake db:migrate
4) rails g active_admin:resource product
5) write in product.rb
In your app/admin/ folder one file generate like 'product.rb'
path is = app/admin/product.rb
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
6) write in dashboards.rb
app/admin/dashboards.rb
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
7) write in application.css.scss
app/assets/stylesheets/application.css.scss
@import "products";
8) write in active_admin.rb
config/initializers/active_admin.rb
config.site_title = "Dipak's Store"
nice post.
ReplyDelete