small medium large xlarge

Generic-user-small
16 Dec 2017, 22:35
George Osborne (3 posts)

I am stuck on the product change highlighting for iteration F5 (Broadcasting updates with Action Cable). I’ve tried creating a partial for the store view and using ActiveRecord::Dirty to try and compare the previous “price” value with the changed value, but I can’t seem to get it to work. Am I making this too complicated? Is there a simple solution to this? Should I be passing additional parameters in the server broadcast?

Generic-user-small
16 Dec 2017, 23:35
George Osborne (3 posts)

I was able to get this working, although, I’m not sure if this is the correct way to do it. I used local_assigns to set the ID of the product being updated. In the view, I compare the ID of the updated product with the ID in the loop, and if it’s equal, I use the highlighted CSS class on the DIV.

Dmfcb_pragsmall
17 Dec 2017, 15:56
David Copeland (511 posts)

There’s always more than one way to do it, and if it works, it works :)

That said, the code in the book does get tested and to make the screenshots for this one I had to execute everything as described and it did work, so you could look at the downloadable code to see if there’s something else you were missing.

Generic-user-small
17 Dec 2017, 16:55
George Osborne (3 posts)

Thanks for responding David. I couldn’t find the implementation of the playtime sections in the code I downloaded. Am I missing something?

You must be logged in to comment