ActiveView::Helpers::InstanceTag

17 views
Skip to first unread message

faust45

unread,
Oct 27, 2008, 7:50:14 AM10/27/08
to Ruby on Rails: Core
Hi lads!
I have a question about ActiveView::Helpers::InstanceTag

This class has method
private
def add_default_name_and_id(options)
if options.has_key?("index")
options["name"] ||= tag_name_with_index(options["index"])
options["id"] ||= tag_id_with_index(options["index"])
options.delete("index")
elsif defined?(@auto_index)
options["name"] ||= tag_name_with_index(@auto_index)
options["id"] ||= tag_id_with_index(@auto_index)
else
options["name"] ||= tag_name + (options.has_key?
('multiple') ? '[]' : '')
options["id"] ||= tag_id
end
end

May be i don't know some thing, but how i can told InstanceTag to
build tag name with 'index' which i pass and 'multiple' at once!?

I think that author intend this code:
private
def add_default_name_and_id(options)
if options.has_key?("index")
options["name"] ||= tag_name_with_index(options["index"])
options["id"] ||= tag_id_with_index(options["index"])
options.delete("index")
elsif defined?(@auto_index)
options["name"] ||= tag_name_with_index(@auto_index)
options["id"] ||= tag_id_with_index(@auto_index)
else
options["id"] ||= tag_id
options["name"] ||= tag_name
end

options["name"] += '[]' if options.has_key?('multiple')
end

Reply all
Reply to author
Forward
0 new messages