# #144 Why I am replacing Turbo Frames with Streams for ActsAsVotable?

- URL: https://superails.com/posts/ruby-on-rails-144-why-i-am-replacing-turbo-frames-with-streams-for-actsasvotable
- Published: 2023-08-25
- Duration: 09:17
- Access: free
- Topics: turbo streams, voting, turbo frames, hotwire
- Playlists: Just enough Hotwire for Rails developers

Some server-side rendering problems can be equally solved by either Turbo Frames or Streams.
Each approach has it's cons and pros.

In this scenario I first implemented Voting with Turbo Frames.
This invoked quite a lot of extra context and calculations when calling a separate posts_controller#show action.
So I replaced Frames with Streams that required no extra context outside the current controller action, and explicitly defined the expected server-side rendered HTML (turbo stream) response.

0:00 How ActsAsVotable is set up on Superails.com
3:28 Turbo Frame refreshes vote buttons
4:50 Turbo Frames grabs new context
5:24 Turbo Streams response to replace Frames
8:37 Conclusion: choose the best tool for the job!

## Chapters

- 0:00 How ActsAsVotable is set up on Superails.com
- 3:28 Turbo Frame refreshes vote buttons
- 4:50 Turbo Frames grabs new context
- 5:24 Turbo Streams response to replace Frames
- 8:37 Conclusion: choose the best tool for the job!
