[Rails] PostgreSQL Array column + has_many association

2018-04-11 Thread Carlos Ferreira da Silva
I'm trying to use an array column to crete an association between 2 models. I remember that in the past this was working, but I think something has changed and now it's not working anymore. Here is the deal: Ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux] Rails 5.1.5

Re: [Rails] Looping and selecting

2018-04-11 Thread Colin Law
On 10 April 2018 at 16:08, kaine wright wrote: > i have this output from an api call > > @output['products'][0] > => >

[Rails] Re: Looping and selecting

2018-04-11 Thread dasibre
How are you looping through the result. When you say you are unable to loop through, what do you mean exactly, what error are you getting On Tuesday, April 10, 2018 at 1:14:24 PM UTC-4, kaine wright wrote: > > i have this output from an api call > > @output['products'][0] > => {"url"=>" >

[Rails] Re: Compare hashes and report where the change was

2018-04-11 Thread kaine wright
If you want to get what is the difference between two hashes, you can do this: result = {} hash1.each {|key, value| result[key] = hash2[key] if hash2[key] != value } puts result or use a this hash1.to_a == hash2.to_a turning it to an array and compairing those. or you could use to_s