Module: Ext::OgScaffold::ControllersClassMethods

Defined in:
lib/ext/og_scaffold.rb

Instance Method Summary collapse

Instance Method Details

#scaffold(model, opts = {}) ⇒ Object Also known as: S



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ext/og_scaffold.rb', line 29

def scaffold(model, opts={})
  defaults = {
    :path => "/#{model.downcase}",
    :name => "#{model}Scaffold"
  }
  opts = opts.merge(defaults)

  klass = Class.new(OgScaffolder)
  klass.path, klass.model = opts[:path], model

  const_set(opts[:name], klass) if opts[:name]

  klass
end