Module: Nitro::Scaffolding

Included in:
Controller
Defined in:
lib/nitro/scaffolding.rb

Overview

Scaffolding is a feature of Nitro that automatically generates maintenance methods for you. It is typically used in the early stages of development or by the auto administration part.

This module is applied to controllers to provide automatically generated CRUD methods. – TODO: add search, add base, add to_title, validate/error handling. ++

Defined Under Namespace

Modules: ClassMethods Classes: ScaffoldCompiler

Class Method Summary collapse

Class Method Details

.class_to_list(klass) ⇒ Object



39
40
41
# File 'lib/nitro/scaffolding.rb', line 39

def self.class_to_list(klass)
  class_to_method(klass).plural
end

.class_to_method(klass) ⇒ Object



35
36
37
# File 'lib/nitro/scaffolding.rb', line 35

def self.class_to_method(klass)
  klass.name.underscore.gsub('::','__').downcase
end

.class_to_path(klass) ⇒ Object



43
44
45
# File 'lib/nitro/scaffolding.rb', line 43

def self.class_to_path(klass)
  klass.name.underscore.gsub('::','/').downcase
end

.included(base) ⇒ Object



28
29
30
31
32
33
# File 'lib/nitro/scaffolding.rb', line 28

def self.included(base)
  super
  base.helper(:form)
  base.helper(:pager)
  base.extend(ClassMethods)
end