lib/lifeform/libraries/default/input.rb in lifeform-0.4.1 vs lib/lifeform/libraries/default/input.rb in lifeform-0.5
- old
+ new
@@ -28,13 +28,12 @@
attributes[:id] ||= attributes[:name].parameterize(separator: "_")
@label = handle_labels if attributes[:label]
end
def model_name
- return @model.to_model.model_name.param_key if @model.respond_to?(:to_model)
+ name_of_model = @form.class.name_of_model(@model)
- # Or just use basic underscore
- @model.class.name.underscore.tr("/", "_")
+ form.parent_name ? "#{form.parent_name}[#{name_of_model}]" : name_of_model
end
def value_for_model
@model.send(attributes[:name])
end