Is there a good admin generator for Ruby on Rails?
Scaffolding is the normal way to create an admin backend BUT there is a project called ActiveScaffold which may solve your problem.
Which Ruby on Rails admin plugin do you use and why? What are the pros and cons of different admin gems?
This is currently the most popular one: https://github.com/sferik/rails_admin
It's a Rails engine rather than a plugin, but it's good looking and useful.
Backend administration in Ruby on Rails
I think namespaces is the solution to the problem you have here:
map.namespace :admin do |admin|
admin.resources :customers
end
Which will create routes admin_customers
, new_admin_customers
, etc.
Then inside the app/controller
directory you can have an admin
directory. Inside your admin directory, create an admin controller:
./script/generate rspec_controller admin/admin
class Admin::AdminController < ApplicationController
layout "admin"
before_filter :login_required
end
Then create an admin customers controller:
./script/generate rspec_controller admin/customers
And make this inhert from your ApplicationController:
class Admin::CustomersController < Admin::AdminController
This will look for views in app/views/admin/customers
and will expect a layout in app/views/layouts/admin.html.erb
.
You can then use whichever plugin or code you like to actually do your administration, streamline, ActiveScaffold, whatever personally I like to use resourcecs_controller
, as it saves you a lot of time if you use a REST style architecture, and forcing yourself down that route can save a lot of time elsewhere. Though if you inherited the application that's a moot point by now.
Web application admin generators
Django's automatic admin app is excellent. Once you've written your models, it automatically creates a full-featured admin app around them where you can create, update and delete records. It's also extensible and customizable for just about whatever you need.
Here's a pretty good overview about it. Django (and python) is intuitive and satisfying to work with -- I highly recommend that you set it up and play with it and see how well it works.
Rails: scaffold. Create admin controller for model
ActiveAdmin is a neat user interface for your Rails application. It gives you a fully customizable user interface to your models.
Site: http://activeadmin.info/
Demo: http://demo.activeadmin.info/admin
Railscasts Episode: http://railscasts.com/episodes/284-active-admin
A good definition for what a Rails-Generator is?
Are they scripts, which are used to create files and/or boilerplate code?
Yes, I think this is a pretty good definition. Here are two definitions from the Rails documentations (although I agree they're a bit vague).
The rails generate command uses templates to create a whole lot of things
Rails scaffolding is a quick way to generate some of the major pieces of an application.
To summarise, a generator is usually a Rake task which does use a template file to create boilerplate code. This is helpful to quickly develop an application.
Generators aren't just provided by Rails itself? Gems like rspec can add Generators to Rails and after an install Rails has that additional Generators? Do I get that right?
Yes, if your gem is a Railties you can install additional generators.
Rails::Railtie is the core of the Rails framework and provides several hooks to extend Rails and/or modify the initialization process.
Here is for instance a template from RSpec.
https://api.rubyonrails.org/classes/Rails/Railtie.html
https://api.rubyonrails.org/classes/Rails/Generators.html
Ruby on Rails 3: administration interface generator?
Active Admin:
Active Admin is a Ruby on Rails plugin for generating administration
style interfaces. It abstracts common business application patterns to
make it simple for developers to implement beautiful and elegant
interfaces with very little effort.
Related Topics
Testing Actionmailer Multipart Emails(Text and HTML Version) with Rspec
Rails, Ruby, How to Sort an Array
Capistrano & Bash: Ignore Command Exit Status
How to Check If a Gem Is Installed
Ruby Regex What Does the \1 Mean for Gsub
Strange Activerecord::Associationtypemismatch
Configuring Jekyll for Github Project Pages
How to Get Files Count in a Directory Using Ruby
How to Create Database from Schema.Rb Without Initializing Rails
Rails - How to Create a Model Linked to Two of Another Model
Ubuntu 12 - How to Install Ruby and Rails Correctly
Reading the First Line of a File in Ruby
Ruby Koan 151 Raising Exceptions
How to Declare a Variable Shared Between Examples in Rspec
Ruby Classes: Initialize Self VS. @Variable
Error About Nokogiri While Capistrano Deployment on Ubuntu Server
Ruby: How to Chain Multiple Method Calls Together with "Send"