def notify_to(*resources)
      options = create_options(:notifications, resources.extract_options!, [:new, :create, :edit, :update])

      resources.each do |target|
        options[:defaults] = { target_type: target.to_s }.merge(options[:devise_defaults])
        resources_options = options.select { |key, _| [:with_devise, :devise_default_routes, :with_subscription, :subscription_option, :model, :devise_defaults].exclude? key }
        if options[:with_devise].present? && options[:devise_default_routes].present?
          create_notification_routes options, resources_options
        else
          self.resources target, only: :none do
            create_notification_routes options, resources_options
          end
        end

        if options[:with_subscription].present? && target.to_s.to_model_class.subscription_enabled?
          subscribed_by target, options[:subscription_option]
        end
      end

      self
    end
def notify_to(*resources)
      options = create_options(:notifications, resources.extract_options!, [:new, :create, :edit, :update])

      resources.each do |target|
        options[:defaults] = { target_type: target.to_s }.merge(options[:devise_defaults])
        resources_options = options.select { |key, _| [:with_devise, :devise_default_routes, :with_subscription, :subscription_option, :model, :devise_defaults].exclude? key }
        if options[:with_devise].present? && options[:devise_default_routes].present?
          create_notification_routes options, resources_options
        else
          self.resources target, only: :none do
            create_notification_routes options, resources_options
          end
        end

        if options[:with_subscription].present? && target.to_s.to_model_class.subscription_enabled?
          subscribed_by target, options[:subscription_option]
        end
      end

      self
    end
Includes notify_to method for routes, which is responsible to generate all necessary routes for notifications of activity_notification.

 When you have an User model configured as a target (e.g. defined acts_as_target),
 you can create as follows in your routes:
   notify_to :users
 This method creates the needed routes:
   # Notification routes
     user_notifications          GET    /users/:user_id/notifications(.:format)
       { controller:"activity_notification/notifications", action:"index", target_type:"users" }
     user_notification           GET    /users/:user_id/notifications/:id(.:format)
       { controller:"activity_notification/notifications", action:"show", target_type:"users" }
     user_notification           DELETE /users/:user_id/notifications/:id(.:format)
       { controller:"activity_notification/notifications", action:"destroy", target_type:"users" }
     open_all_user_notifications POST   /users/:user_id/notifications/open_all(.:format)
       { controller:"activity_notification/notifications", action:"open_all", target_type:"users" }
     move_user_notification      GET    /users/:user_id/notifications/:id/move(.:format)
       { controller:"activity_notification/notifications", action:"move", target_type:"users" }
     open_user_notification      POST   /users/:user_id/notifications/:id/open(.:format)
       { controller:"activity_notification/notifications", action:"open", target_type:"users" }

 You can also configure notification routes with scope like this:
   scope :myscope, as: :myscope do
     notify_to :users, routing_scope: :myscope
   end
 This routing_scope option creates the needed routes with specified scope like this:
   # Notification routes
     myscope_user_notifications          GET    /myscope/users/:user_id/notifications(.:format)
       { controller:"activity_notification/notifications", action:"index", target_type:"users", routing_scope: :myscope }
     myscope_user_notification           GET    /myscope/users/:user_id/notifications/:id(.:format)
       { controller:"activity_notification/notifications", action:"show", target_type:"users", routing_scope: :myscope }
     myscope_user_notification           DELETE /myscope/users/:user_id/notifications/:id(.:format)
       { controller:"activity_notification/notifications", action:"destroy", target_type:"users", routing_scope: :myscope }
     open_all_myscope_user_notifications POST   /myscope/users/:user_id/notifications/open_all(.:format)
       { controller:"activity_notification/notifications", action:"open_all", target_type:"users", routing_scope: :myscope }
     move_myscope_user_notification      GET    /myscope/users/:user_id/notifications/:id/move(.:format)
       { controller:"activity_notification/notifications", action:"move", target_type:"users", routing_scope: :myscope }
     open_myscope_user_notification      POST   /myscope/users/:user_id/notifications/:id/open(.:format)
       { controller:"activity_notification/notifications", action:"open", target_type:"users", routing_scope: :myscope }

 When you use devise authentication and you want make notification targets assciated with devise,
 you can create as follows in your routes:
   notify_to :users, with_devise: :users
 This with_devise option creates the needed routes assciated with devise authentication:
   # Notification with devise routes
     user_notifications          GET    /users/:user_id/notifications(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"index", target_type:"users", devise_type:"users" }
     user_notification           GET    /users/:user_id/notifications/:id(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"show", target_type:"users", devise_type:"users" }
     user_notification           DELETE /users/:user_id/notifications/:id(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"destroy", target_type:"users", devise_type:"users" }
     open_all_user_notifications POST   /users/:user_id/notifications/open_all(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"open_all", target_type:"users", devise_type:"users" }
     move_user_notification      GET    /users/:user_id/notifications/:id/move(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"move", target_type:"users", devise_type:"users" }
     open_user_notification      POST   /users/:user_id/notifications/:id/open(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"open", target_type:"users", devise_type:"users" }

 When you use with_devise option and you want to make simple default routes as follows, you can use devise_default_routes option:
   notify_to :users, with_devise: :users, devise_default_routes: true
 These with_devise and devise_default_routes options create the needed routes assciated with authenticated devise resource as the default target
   # Notification with default devise routes
     user_notifications          GET    /notifications(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"index", target_type:"users", devise_type:"users" }
     user_notification           GET    /notifications/:id(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"show", target_type:"users", devise_type:"users" }
     user_notification           DELETE /notifications/:id(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"destroy", target_type:"users", devise_type:"users" }
     open_all_user_notifications POST   /notifications/open_all(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"open_all", target_type:"users", devise_type:"users" }
     move_user_notification      GET    /notifications/:id/move(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"move", target_type:"users", devise_type:"users" }
     open_user_notification      POST   /notifications/:id/open(.:format)
       { controller:"activity_notification/notifications_with_devise", action:"open", target_type:"users", devise_type:"users" }

 When you would like to define subscription management paths with notification paths,
 you can create as follows in your routes:
   notify_to :users, with_subscription: true
 or you can also set options for subscription path:
   notify_to :users, with_subscription: { except: [:index] }
 If you configure this :with_subscription option with :with_devise option, with_subscription paths are also automatically configured with devise authentication as the same as notifications
   notify_to :users, with_devise: :users, with_subscription: true

 @example Define notify_to in config/routes.rb
   notify_to :users
 @example Define notify_to with options
   notify_to :users, only: [:open, :open_all, :move]
 @example Integrated with Devise authentication
   notify_to :users, with_devise: :users
 @example Define notification paths including subscription paths
   notify_to :users, with_subscription: true
 @example Integrated with Devise authentication as simple default routes including subscription management
   notify_to :users, with_devise: :users, devise_default_routes: true, with_subscription: true
 @example Integrated with Devise authentication as simple default routes with scope including subscription management
   scope :myscope, as: :myscope do
     notify_to :myscope, with_devise: :users, devise_default_routes: true, with_subscription: true, routing_scope: :myscope
   end

 @overload notify_to(*resources, *options)
   @param          [Symbol]       resources Resources to notify
   @option options [String]       :routing_scope         (nil)            Routing scope for notification routes
   @option options [Symbol]       :with_devise           (false)          Devise resources name for devise integration. Devise integration will be enabled by this option.
   @option options [Boolean]      :devise_default_routes (false)          Whether you will create routes as device default routes assciated with authenticated devise resource as the default target
   @option options [Hash|Boolean] :with_subscription     (false)          Subscription path options to define subscription management paths with notification paths. Calls subscribed_by routing when truthy value is passed as this option.
   @option options [String]       :model                 (:notifications) Model name of notifications
   @option options [String]       :controller            ("activity_notification/notifications" | activity_notification/notifications_with_devise") :controller option as resources routing
   @option options [Symbol]       :as                    (nil)            :as option as resources routing
   @option options [Array]        :only                  (nil)            :only option as resources routing
   @option options [Array]        :except                (nil)            :except option as resources routing
 @return [ActionDispatch::Routing::Mapper] Routing mapper instance