Wednesday, December 28, 2011

active-admin sass and rails 3

by Sandip Ransing 0 comments

active_admin is the good way to provide rails administrative interface.
It provides front-end db administration and its customizable too :)
# Gemfile gem 'activeadmin' gem 'sass-rails' gem "meta_search", '>= 1.1.0.pre'
Bundle install, generate config & migrate db
bundle install rails g active_admin:install rake db:migrate Config
# config/initializers/active_admin.rb ActiveAdmin.setup do |config| config.site_title = "Web Site :: Admin Panel" config.site_title_link = "/" config.default_namespace = :siteadmin config.authentication_method = :authenticate_admin_user! config.current_user_method = :current_admin_user config.logout_link_method = :delete end
Registering new resource
rails generate active_admin:resource category Customization
# app/admin/categories.rb ActiveAdmin.register Category do scope :published form do |f| f.inputs do f.input :name, :label => 'Name' f.input :for_type, :label => "Category Type" end f.buttons end end Adding Dashboard
ActiveAdmin::Dashboards.build do section "Recent Categories" do table_for Category.published.recent.limit(2) do column :name do |c| link_to c.name, [:admin, c] end column :created_at end strong { link_to "View All Categories", admin_categories_path } end end

blog comments powered by Disqus

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter