Class: SeoLandingPagesGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/seo_landing_pages_generator.rb

Instance Method Summary collapse

Instance Method Details

#active_adminObject

Public: copies the active admin boilerplate code.



21
22
23
# File 'lib/generators/seo_landing_pages_generator.rb', line 21

def active_admin
  copy_file 'active_admin.rb', 'app/admin/seo_landing_pages.rb'
end

#adminObject

Public: copies the CRUD admin code.



38
39
40
# File 'lib/generators/seo_landing_pages_generator.rb', line 38

def admin
  #TODO
end

#controllerObject

Public: configures the application controller to include the Helpers module.



14
15
16
17
18
# File 'lib/generators/seo_landing_pages_generator.rb', line 14

def controller
  inject_into_class 'app/controllers/application_controller.rb', ApplicationController do
    "  include SeoLandingPages::Controllers::Helpers\n\n"
  end
end

#i18nObject

Public: copies the i18n files.



26
27
28
29
30
# File 'lib/generators/seo_landing_pages_generator.rb', line 26

def i18n
  %w(en es).each do |locale|
    copy_file "i18n.#{ locale }.yml", "config/locales/seo_landing_pages.#{ locale }.yml"
  end
end

#migrationObject

Public: copies the migration.



9
10
11
# File 'lib/generators/seo_landing_pages_generator.rb', line 9

def migration
  migration_template 'migration.rb', 'db/migrate/create_seo_landing_pages.rb'
end

#routeObject

Public: adds an admin route to the router.



33
34
35
# File 'lib/generators/seo_landing_pages_generator.rb', line 33

def route
  #TODO
end