Sha256: 929a9a1557fc541edb0ac92b788cb4135fec55f7caccacedb4c0fc312d5ab528

Contents?: true

Size: 819 Bytes

Versions: 39

Compression:

Stored size: 819 Bytes

Contents

require 'rails/generators/named_base'

module Devise
  module Generators
    class DeviseGenerator < Rails::Generators::NamedBase
      include Rails::Generators::ResourceHelpers

      namespace "devise"
      source_root File.expand_path("../templates", __FILE__)

      desc "Generates a model with the given NAME (if one does not exist) with devise " <<
           "configuration plus a migration file and devise routes."

      hook_for :orm

      class_option :routes, desc: "Generate routes", type: :boolean, default: true

      def add_devise_routes
        devise_route  = "devise_for :#{plural_name}"
        devise_route << %Q(, class_name: "#{class_name}") if class_name.include?("::")
        devise_route << %Q(, skip: :all) unless options.routes?
        route devise_route
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 8 rubygems

Version Path
devise-4.3.0 lib/generators/devise/devise_generator.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/devise-4.2.1/lib/generators/devise/devise_generator.rb
devise-4.2.1 lib/generators/devise/devise_generator.rb
devise-4.2.0 lib/generators/devise/devise_generator.rb
devise-3.5.10 lib/generators/devise/devise_generator.rb
devise-4.0.3 lib/generators/devise/devise_generator.rb
devise-4.1.1 lib/generators/devise/devise_generator.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/lib/generators/devise/devise_generator.rb
devise-4.1.0 lib/generators/devise/devise_generator.rb
devise-3.5.9 lib/generators/devise/devise_generator.rb
devise-4.0.2 lib/generators/devise/devise_generator.rb
devise-4.0.1 lib/generators/devise/devise_generator.rb
devise-3.5.8 lib/generators/devise/devise_generator.rb
devise-3.5.7 lib/generators/devise/devise_generator.rb
devise-4.0.0 lib/generators/devise/devise_generator.rb
devise-4.0.0.rc2 lib/generators/devise/devise_generator.rb
devise-4.0.0.rc1 lib/generators/devise/devise_generator.rb
devise-3.5.6 lib/generators/devise/devise_generator.rb
devise-3.5.5 lib/generators/devise/devise_generator.rb
devise-3.5.4 lib/generators/devise/devise_generator.rb