Class: SimpleHashtag::Generators::ViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/simple_hashtag/views_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_viewsObject



7
8
9
10
11
12
13
14
15
# File 'lib/generators/simple_hashtag/views_generator.rb', line 7

def generate_views
  copy_file "views/hashtags_controller.rb", "app/controllers/hashtags_controller.rb"
  copy_file "views/hashtags_helper.rb", "app/helpers/hashtags_helper.rb"
  copy_file "views/hashtags_index.html.erb", "app/views/hashtags/index.html.erb"
  copy_file "views/hashtags_show.html.erb", "app/views/hashtags/show.html.erb"

  route 'get "hashtags",            to: "hashtags#index",     as: :hashtags'
  route 'get "hashtags/:hashtag",   to: "hashtags#show",      as: :hashtag'
end