module Para::Stall::Inputs::VariantInputHelper
Private Instance Methods
ensure_target_relation_present!()
click to toggle source
Raises a comprehensive error for easy wrong form attribute catching
# File lib/para/stall/inputs/variant_input_helper.rb, line 25 def ensure_target_relation_present! unless model.reflect_on_association(attribute_name) raise NoMethodError, "Relation ##{ attribute_name } does not exist for model #{ model.name }." end end
model()
click to toggle source
# File lib/para/stall/inputs/variant_input_helper.rb, line 11 def model @model ||= resource.class end
resource()
click to toggle source
# File lib/para/stall/inputs/variant_input_helper.rb, line 7 def resource @resource ||= @builder.object end
variant_sort_method(variant)
click to toggle source
# File lib/para/stall/inputs/variant_input_helper.rb, line 15 def variant_sort_method(variant) properties.map do |property_config| if (variant_value = property_config.variant_property_value_for(variant)) variant_value.property_value.position end end.join(':') end