list = []
Merchant.all.each do |merchant|
if merchant.url.present? && merchant.url != merchant.api_data.url
list.push({
:id => merchant.id,
:name => merchant.name,
:another => merchant.another,
:another => merchant.another,
:another => merchant.another
})
end
end
Is there is simpler way to create a hash of only some of the fields of that object? Sorry if this is too obvious. I’m transitioning over to Ruby from PHP.
Notes:
list. Give meaningful names to variables.Using records: