Method: Facebooker::Rails::FacebookFormBuilder#add_default_name_and_id

Defined in:
lib/facebooker/rails/facebook_form_builder.rb

#add_default_name_and_id(options, method) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/facebooker/rails/facebook_form_builder.rb', line 106

def add_default_name_and_id(options, method)
  @method_name = method
  if options.has_key?("index")
    options["name"] ||= tag_name_with_index(options["index"])
    options["id"]   ||= tag_id_with_index(options["index"])
    options.delete("index")
  else
    options["name"] ||= tag_name + (options.has_key?('multiple') ? '[]' : '')
    options["id"]   ||= "#{sanitized_object_name}_#{sanitized_method_name}"
  end
end