Tell me how to create a similar hash. I have a view loop:
sms_send = {} SmsSend.all.each do |record| if !record.is_send sms_send.merge!(record.sms_number => Russian.translit(record.sms_text)) record.is_send = 1 record.save end
At the output, the hash now looks like this: {'12345678' => 'test1', '123456789' => 'test1'}
, and how to make another value added there, record.uid
, so that the output has the following hash:
{ 'record.uid(1)' => { record.sms_number(1) => Russian.translit(record.sms_text(1)) }, 'record.uid(2)' => { record.sms_number(2) => Russian.translit(record.sms_text(2)) } }
Ie, that at first there was a unique key record.uid
, and then went the values? That at each iteration there values were added, depending on a condition.