Activity
Posted in Custom Turbo Stream Actions Discussion
You sure can do that. I would have each file register the function itself and all you'd need to is require those files.
Disabling Turbo is the right solution for any oauth links that redirect externally.
Just re-assign it to the variant?
record.update(image: record.image.variant(...))
A flash message is set for the next full HTTP request. A turbo stream response is only a partial update to the existing page, so you would need to add a turbo stream to inject a flash message if you wanted to keep that.
You're welcome and thanks for watching! Hope it helps you solve problems in the future. 👍
Excellent! That stuff has always been poorly documented, so I'm glad we could help!
Glad you enjoyed it Michael! We will have to do more episodes like this. 💪
I get irrationally excited when I learn how Rails or other gems work internally. Love the feeling when something feels like a mystery and then you realize it's actually really straightforward when you see how it works. ❤️
I have done this in a few previous episodes (can't remember which ones) so you'll have to see if you can find those. We will definitely cover more stuff like this in the future!
Posted in Pass variable to Flash object
You can use html_safe on the notice message to allow them to include HTML.
redirect_to some_path, notice: "<div data-controller=\"autohide\">Some message</div>"
Glad you liked it Ahmed!
Glad you're enjoying it. We'll keep doing more Hotwire stuff!
They sure do and we will absolutely cover more ideas for them. Next episode is going to walk through using them to implement browser notifications. 👍
Yep! I think a Stimulus controller for remove probably makes the most sense, however this was a great example to show off a small custom Turbo Stream.
I just updated the Windows 10 and 11 guides.
You have to manually enable systemd right now, but you can start Postgres using:
sudo service postgresql start
The old episodes are still there. This is just a new series digging deeper into designing API clients. 👍
Try setting it to use host: 127.0.0.1
in database.yml.
By default, it's going to look for the Unix domain socket, which means a file on the linux system and not the port from your Windows PostgreSQL server.
The number_to_currency
helper is useful for this and I highly recommend the money gem.
To start redis now and restart at login:
brew services start redis
Errors are definitely a bit of a pain. I liked this approach from StackOverflow: https://stackoverflow.com/questions/5370697/what-s-the-best-way-to-handle-exceptions-from-nethttp
ALL_NET_HTTP_ERRORS = [
Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
]
begin
your_http_logic()
rescue *ALL_NET_HTTP_ERRORS
…
end