Class: Para::Page::SectionGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Generators::NameHelpers
Defined in:
lib/generators/para/page/section/section_generator.rb

Instance Method Summary collapse

Methods included from Generators::NameHelpers

#namespaced_class_name, #plural_namespaced_path, #singular_namespaced_path

Instance Method Details

#generate_fieldsObject



17
18
19
# File 'lib/generators/para/page/section/section_generator.rb', line 17

def generate_fields
  generate 'para:nested_fields', "page_section/#{ singular_namespaced_path }"
end

#generate_modelObject



10
11
12
13
14
15
# File 'lib/generators/para/page/section/section_generator.rb', line 10

def generate_model
  template(
    "section.rb.erb",
    "app/models/page_section/#{ singular_namespaced_path }.rb"
  )
end

#generate_templateObject



21
22
23
24
25
26
# File 'lib/generators/para/page/section/section_generator.rb', line 21

def generate_template
  template(
    "section.html.haml.erb",
    "app/views/page_section/#{ plural_namespaced_path }/_#{ singular_namespaced_path }.html.haml"
  )
end