Class: Rails::Generators::JbuilderGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/jbuilder_generator.rb

Instance Method Summary collapse

Instance Method Details

#attributes_list(attributes = attributes_names) ⇒ Object



16
17
18
# File 'lib/generators/jbuilder_generator.rb', line 16

def attributes_list(attributes = attributes_names)
  attributes.map { |a| ":#{a}"}.join(",\n" + ' '*14)
end

#copy_view_filesObject



8
9
10
11
12
13
14
# File 'lib/generators/jbuilder_generator.rb', line 8

def copy_view_files
  ['index', '_show'].each do |view|
    filename = filename_with_extensions(view)
    template filename, File.join('app/views', controller_file_path, filename)
  end
  template filename_with_extensions('partial'), File.join('app/views', controller_file_path, filename_with_extensions("_#{singular_name}"))
end