Skip to content

Commit 5b5c46a

Browse files
Use remove_possible_method to handle 3.0 Gemfile
3.0 does not contain the assets method.
1 parent 2bc416b commit 5b5c46a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/sprockets/railtie.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
require 'action_controller/railtie'
44
require 'sprockets'
55
require 'sprockets/rails/helper'
6+
require 'active_support/core_ext/module/remove_method'
67

78
module Rails
89
class Application
910
# Hack: We need to remove Rails' built in config.assets so we can
1011
# do our own thing.
1112
class Configuration
12-
if instance_methods.map(&:to_sym).include?(:assets)
13-
undef_method :assets
14-
end
13+
remove_possible_method :assets
1514
end
1615

1716
# Undefine Rails' assets method before redefining it, to avoid warnings.
18-
undef_method :assets
17+
remove_possible_method :assets
1918
# Returns Sprockets::Environment for app config.
2019
def assets
2120
return @assets if defined? @assets

0 commit comments

Comments
 (0)