Sha256: 7290e95c117fcd5df6c44b23868a2296ecd984477658af2fc96d7d72427e38cd

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require "generators/devise/views_generator"

module Devise
  module Generators
    class FormtasticGenerator < Rails::Generators::Base #:nodoc:
      include Devise::Generators::ViewPathTemplates
      source_root File.expand_path("../../../../app/views/devise", __FILE__)
      desc "Copies Formtastic enabled views to your application."
      hide!
    end

    class SharedViewsGenerator < Rails::Generators::Base #:nodoc:
      include Devise::Generators::ViewPathTemplates
      source_root File.expand_path("../../../../app/views/devise", __FILE__)
      desc "Copies shared Formtastic enabled views to your application."
      hide!

      # Override copy_views to just copy mailer and shared.
      def copy_views
        view_directory :shared
      end
    end

    class ViewsGenerator < Rails::Generators::Base
      remove_hook_for :form_builder
      hook_for :form_builder, aliases: "-b",
                              desc: "Form builder to be used",
                              default: defined?(Formtastic) ? "formtastic" : "form_for"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-formtastic-0.0.1 lib/generators/devise-formtastic/views_generator.rb