Sha256: 6b3d5a0136f84d24814ca752824066cacaeab1b982b7077da667798eee3b7a84
Contents?: true
Size: 1.33 KB
Versions: 26
Compression:
Stored size: 1.33 KB
Contents
module DynamicScaffold class Config attr_reader( :model, :form, :list, :title, :controller, :lock_before_count, :max_count_options, :scope_options ) def initialize(model, controller) @model = model @controller = controller @form = FormBuilder.new(self) @list = ListBuilder.new(self) @title = Title.new(self) @vars = Vars.new(self) @max_count_options = {} end def vars(name = nil, &block) if block_given? raise ArgumentError, 'Missing var name.' if name.nil? @vars._register(name, block) else @vars end end def scope(*args) if args.present? @scope_options = args.extract_options! @scope = args[0] end @scope end def max_count(count = nil, options = nil, &block) @max_count = count unless count.nil? @max_count_options = options unless options.nil? @lock_before_count = block if block_given? @max_count end def max_count?(count) return false if max_count.nil? count >= max_count end end class GlobalConfig attr_accessor :form class Form def label(&block) @label = block if block_given? @label end end def initialize @form = Form.new end end end
Version data entries
26 entries across 26 versions & 1 rubygems