Module: PricingProgramAssignersHelper
- Defined in:
- app/helpers/pricing_program_assigners_helper.rb
Overview
View helper: pricing program assigners.
Instance Method Summary collapse
- #pricing_program_assigner_attribute_hidden_fields(pricing_program_assigner) ⇒ Object
- #pricing_program_assigner_attributes_params(to_param = true) ⇒ Object
Instance Method Details
#pricing_program_assigner_attribute_hidden_fields(pricing_program_assigner) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/pricing_program_assigners_helper.rb', line 4 def pricing_program_assigner_attribute_hidden_fields(pricing_program_assigner) pricing_program_assigner.attributes.map do |attr_key, value| unless value.nil? # using .present? here will return false if it's a false value if value.is_a? Array value.map { |v| hidden_field_tag("pricing_program_assigner[#{attr_key}][]", v) } else hidden_field_tag("pricing_program_assigner[#{attr_key}]", value) end end end.flatten.compact.join.html_safe end |
#pricing_program_assigner_attributes_params(to_param = true) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/pricing_program_assigners_helper.rb', line 16 def pricing_program_assigner_attributes_params(to_param = true) attr_hash = { pricing_program_assigner: {} } @pricing_program_assigner.attributes.each do |attr_key, value| attr_hash[:pricing_program_assigner][attr_key] = value unless value.nil? end if to_param attr_hash.to_param else attr_hash end end |