Skip to content

Instantly share code, notes, and snippets.

@taq

taq/html5.rb

Created May 19, 2010
Embed
What would you like to do?
module ActionView
module Helpers
module FormHelper
def email_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options)
end
def url_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options)
end
def search_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("search", options)
end
end
class FormBuilder
%w(email_field url_field search_field).each do |selector|
src = <<-end_src
def #{selector}(method,options={})
@template.send(#{selector.inspect},@object_name,method,objectify_options(options))
end
end_src
class_eval src, __FILE__, __LINE__
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment