Class: LocalizedControllersGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/localized_controllers/localized_controllers_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_controller_fileObject



9
10
11
12
13
14
15
16
# File 'lib/generators/localized_controllers/localized_controllers_generator.rb', line 9

def create_controller_file
  template "controller.rb",
           File.join(
             "app/controllers",
             class_path,
             "#{file_name}_#{locale}_controller.rb"
           )
end

#create_view_filesObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/localized_controllers/localized_controllers_generator.rb', line 18

def create_view_files
  actions.each do |action|
    @action = action
    template "view.html.erb",
             File.join(
               "app/views",
               class_path,
               file_name,
               "#{action}.#{locale}.html.erb"
             )
  end
end