Sha256: 71b2ed78db0274c57461857f8eaf2a72e9085759fbaab820f1209aa22f053956
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 Bytes
Contents
module Formic class Input < Base default_template 'formic/default/input' attr_reader :field def label return self.options[:label] if self.options[:label] return @field.underscore.gsub('_', ' ').titleize end def _initialize name=nil, options={}, &block if name.instance_of? Hash options = name name = nil end super options, &block @field = name || options[:name] if !options[:name] if @field && self.form && self.form.model self.options[:name] = "#{self.form.model.class.to_s.downcase}[#{name}]" self.options[:value] ||= self.form.model.send(@field.to_sym) elsif self.options[:name] = name end end return self end def form self.formics.each do |element| return element if element.instance_of? Formic::Form end return nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
formic-0.2.5 | lib/formic/input.rb |