Module: Devise::Generators::ViewPathTemplates

Extended by:
ActiveSupport::Concern
Included in:
ErbGenerator, FormForGenerator, MarkerbGenerator, SharedViewsGenerator, SimpleFormForGenerator
Defined in:
lib/generators/devise/views_generator.rb

Overview

Include this module in your generator to generate Devise views. ‘copy_views` is the main method and by default copies all views with forms.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#copy_viewsObject



28
29
30
31
32
33
34
# File 'lib/generators/devise/views_generator.rb', line 28

def copy_views
  view_directory :confirmations
  view_directory :passwords
  view_directory :registrations
  view_directory :sessions
  view_directory :unlocks
end

#target_pathObject (protected)



48
49
50
# File 'lib/generators/devise/views_generator.rb', line 48

def target_path
  @target_path ||= "app/views/#{scope || :devise}"
end

#view_directory(name, _target_path = nil) ⇒ Object (protected)



38
39
40
41
42
43
44
45
46
# File 'lib/generators/devise/views_generator.rb', line 38

def view_directory(name, _target_path = nil)
  directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
    if scope
      content.gsub "devise/shared/links", "#{scope}/shared/links"
    else
      content
    end
  end
end