Created
October 9, 2012 14:57
-
-
Save mikebaldry/3859353 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
tag_method_map = {"string" => :text_field_tag, "text" => :text_area_tag, "integer" => :number_field_tag} | |
tag_method = tag_method_map[options[:type]] | |
input = @template.send(tag_method, options[:name], "", :class => options[:input_class], :required => options[:required] ? "required" : nil) |
Author
mikebaldry
commented
Oct 9, 2012
tag_method_map = {string: :text_field_tag, text: :text_area_tag, integer: :number_field_tag}
type = options.delete :type
name = options.delete :name
klass = options.delete :input_class
required = options.delete(:required) ? "required" : nil
input = @template.send(tag_method_map[type.to_sym], name, "", class: klass, required: required)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment