-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathadmin.rb
More file actions
32 lines (30 loc) · 841 Bytes
/
admin.rb
File metadata and controls
32 lines (30 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true
def add_author_resource(options = {}, &block)
ActiveAdmin.register Author do
config.filters = false
active_admin_import(options, &block)
end
Rails.application.reload_routes!
end
def add_post_resource(options = {}, &block)
cb = options.delete(:controller_block)
ActiveAdmin.register Post do
config.filters = false
controller(&cb) if cb
active_admin_import(options, &block)
end
Rails.application.reload_routes!
end
def add_nested_post_comment_resource(options = {}, &block)
cb = options.delete(:controller_block)
ActiveAdmin.register Post do
config.filters = false
end
ActiveAdmin.register PostComment do
config.filters = false
belongs_to :post
controller(&cb) if cb
active_admin_import(options, &block)
end
Rails.application.reload_routes!
end