Skip to content

Commit

Permalink
Merge 33d2711 into 6adb90e
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschilling committed Sep 3, 2014
2 parents 6adb90e + 33d2711 commit 84e2a51
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/generators/active_admin/page/USAGE
@@ -0,0 +1,8 @@
Description:
Registers pages with Active Admin

Example:
rails generate active_admin:page Thing

This will create:
app/admin/thing.rb
12 changes: 12 additions & 0 deletions lib/generators/active_admin/page/page_generator.rb
@@ -0,0 +1,12 @@
module ActiveAdmin
module Generators
class PageGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)

def generate_config_file
template "page.rb", "app/admin/#{file_path.gsub('/', '_')}.rb"
end

end
end
end
18 changes: 18 additions & 0 deletions lib/generators/active_admin/page/templates/page.rb
@@ -0,0 +1,18 @@
ActiveAdmin.register <%= class_name %> do

<% if Rails::VERSION::MAJOR == 4 || defined?(ActionController::StrongParameters) %>
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# permit_params :list, :of, :attributes, :on, :model
#
# or
#
# permit_params do
# permitted = [:permitted, :attributes]
# permitted << :other if resource.something?
# permitted
# end
<% end %>

end

0 comments on commit 84e2a51

Please sign in to comment.