ruby / rails: TypeError: can't convert Symbol into Integer -


i'm trying update representation attributes ivpn & idirect (from csv file via rake task print here meat of program) , getting typeerror:

# in rails console: representation = representation.where(id: 977) # => representation_id: 977, ivnp: false, idirect: false  rows = hash.[:ivpn => "", :idirect => "x"] # rows coming csv-file  representation.update_attributes! ivpn: rows.any?{|r| r[:ivpn].present?}, idirect: rows.any? {|r| r[:idirect].present?}  typeerror: can't convert symbol integer         (irb):42:in `[]'         (irb):42:in `block in irb_binding'         (irb):42:in `each'         (irb):42:in `any?' 

what i'm missing here?

try this:

representation.update_attributes! ivpn: rows.any?[{|r| r[:ivpn].present?}], idirect: rows.any? [{|r| r[:idirect].present?}] 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -