Sha256: 7ded4d9795921b5071320f2322a31cf502d10dca1101a7001d7f54d880da3d6e

Contents?: true

Size: 736 Bytes

Versions: 4

Compression:

Stored size: 736 Bytes

Contents

require 'rails/generators/active_record'

module ActivityNotification
  module Generators
    # Notification generator to create customizable notification model from templates.
    # @example Run notification generator to create customizable notification model
    #   rails generate activity_notification:notification
    class NotificationGenerator < ActiveRecord::Generators::Base
      source_root File.expand_path("../../../templates/notification", __FILE__)

      argument :name, type: :string, default: 'Notification'

      # Create notification model in application directory
      def create_models
        @model_name = name
        template 'notification.rb', "app/models/#{name.underscore}.rb"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activity_notification-1.0.2 lib/generators/activity_notification/notification/notification_generator.rb
activity_notification-1.0.1 lib/generators/activity_notification/models/notification_generator.rb
activity_notification-1.0.0 lib/generators/activity_notification/models/notification_generator.rb
activity_notification-0.0.10 lib/generators/activity_notification/models/notification_generator.rb