blob: ce5182d20fa83edf4fd0182b8a6070e071556c7f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module ActionView
module Helpers
module Tags
class TextField < Base #:nodoc:
def render
options = @options.stringify_keys
options["size"] = options["maxlength"] || DEFAULT_FIELD_OPTIONS["size"] unless options.key?("size")
options = DEFAULT_FIELD_OPTIONS.merge(options)
options["type"] ||= field_type
options["value"] = options.fetch("value"){ value_before_type_cast(object) } unless field_type == "file"
options["value"] &&= ERB::Util.html_escape(options["value"])
add_default_name_and_id(options)
tag("input", options)
end
class << self
def field_type
@field_type ||= self.name.split("::").last.sub("Field", "").downcase
end
end
private
def field_type
self.class.field_type
end
end
end
end
end
|