Created
May 19, 2010 01:35
-
-
Save taq/405838 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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