File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1
1
require 'active_admin/mongoid'
2
+ require "rails/generators/actions"
3
+ require "rails/generators/named_base"
4
+
5
+ # Considering the Rails::Generators::NamedBase is one of the nearest ancestor to
6
+ # ActiveAdmin::Generators::InstallGenerator, we can open the class and an empty create_migration
7
+ # to the class(which will overridden by other subclasses). We can specifically focus on the
8
+ # ActiveAdmin::Generators::InstallGenerator class and apply remove_method during the method_added call
9
+ # and thereby pushing ActiveAdmin::Generators::InstallGenerator to use our empty create_migrations method.
10
+
11
+ Rails ::Generators ::NamedBase . class_eval do
12
+
13
+ def create_migrations
14
+ end
15
+
16
+ def self . inherited ( klass )
17
+ super
18
+ if klass . name == "ActiveAdmin::Generators::InstallGenerator"
19
+
20
+ klass . class_eval do
21
+ def self . method_added ( method_name )
22
+ super
23
+ remove_method method_name if method_name == :create_migrations
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
You can’t perform that action at this time.
0 commit comments