Module: PricingProgramAssignersHelper
- Defined in:
- app/helpers/pricing_program_assigners_helper.rb
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
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/pricing_program_assigners_helper.rb', line 3 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
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/pricing_program_assigners_helper.rb', line 15 def pricing_program_assigner_attributes_params(to_param = true) attr_hash = { pricing_program_assigner: {}} @pricing_program_assigner.attributes.each do |attr_key, value| unless value.nil? attr_hash[:pricing_program_assigner][attr_key] = value end end if to_param attr_hash.to_param else attr_hash end end |