diff --git a/lib/apotomo/railtie.rb b/lib/apotomo/railtie.rb index c144bdc..106ae34 100644 --- a/lib/apotomo/railtie.rb +++ b/lib/apotomo/railtie.rb @@ -6,10 +6,14 @@ class Railtie < ::Rails::Railtie load "apotomo/apotomo.rake" end - # As we are a Railtie only, the routes won't be loaded automatically. Beside that, we want our - # route to be the very first (otherwise #resources might supersede it). - initializer 'apotomo.prepend_routes', :after => :add_routing_paths do |app| - app.routes_reloader.paths.unshift(File.dirname(__FILE__) + "/../../config/routes.rb") + # In Rails 5.1, a dynamic :controller segment in a route is deprecated. + # The routes for each controller have to be added in routes.rb. + if ::ActiveRecord.gem_version < ::Gem::Version.new("5.1.0.beta1") + # As we are a Railtie only, the routes won't be loaded automatically. Beside that, we want our + # route to be the very first (otherwise #resources might supersede it). + initializer 'apotomo.prepend_routes', :after => :add_routing_paths do |app| + app.routes_reloader.paths.unshift(File.dirname(__FILE__) + "/../../config/routes.rb") + end end # Include a lazy loader via has_widgets. diff --git a/lib/apotomo/widget/event_methods.rb b/lib/apotomo/widget/event_methods.rb index 491017d..17cae90 100644 --- a/lib/apotomo/widget/event_methods.rb +++ b/lib/apotomo/widget/event_methods.rb @@ -8,7 +8,7 @@ module EventMethods included do after_initialize do self.class.responds_to_event_options.each do |args| - type, options = args[0], args[1] || {} + type, options = args[0], (args[1] || {}).clone target = self if target_id = options[:passing]