class Devise::Async::Stretch::InstallGenerator

Public Instance Methods

add_stretch_mark() click to toggle source
# File lib/generators/devise/async/stretch/install_generator.rb, line 22
def add_stretch_mark
  generate "migration", "AddStretchMarkTo#{name} stretch_mark:string"
  rake "db:migrate"
end
copy_initializer() click to toggle source
# File lib/generators/devise/async/stretch/install_generator.rb, line 13
def copy_initializer
  template "devise_async_stretch.rb", "config/initializers/devise_async_stretch.rb"
end
inject_devise_invitable_content() click to toggle source
# File lib/generators/devise/async/stretch/install_generator.rb, line 17
def inject_devise_invitable_content
  path = File.join("app", "models", "#{file_path}.rb")
  inject_into_file(path, ", :stretchable", :after => ":database_authenticatable") if File.exists?(path)
end
populate_stretch_marks() click to toggle source
# File lib/generators/devise/async/stretch/install_generator.rb, line 27
def populate_stretch_marks
  name.constantize.to_adapter.find_all.each do |record|
    if record.stretch_mark.blank?
      record.update(stretch_mark: SecureRandom.hex(15)[0,29])
    end
  end
end