Posted in Question regarding the threaded comments! Post titles or link_to post only if the current user is on another users show page.
If you link to the page the post is on, you can set the anchor in the link to to scroll down to the comment.
For example, your post here has an anchor on it:
You would link to
post_path(comment.post, anchor: dom_id(comment)) which is basically what I'm doing, but mine are called forum threads and forum posts here on GoRails.
Posted in How do you handle the Sitemap for a user generated content website like a social media network?
As long as the page is linked somewhere, Google will usually find and index it automatically, so you may not need to do this as
You could probably use the sitemap_generator gem to create sitemaps and point Google to it. https://github.com/kjvarga/sitemap_generator
Try using the
simple_format helper. https://apidock.com/rails/ActionView/Helpers/TextHelper/simple_format
You're welcome! Glad that worked out pretty easily!
The error sounds like you maybe didn't pass in a URL properly in somewhere. Print out the
row["coverphoto"] to make sure it's a valid URL.
Also you should change the line to this:
stadium = Stadium.create(name: row["name"],city: row["city"], image_remote_url: row["coverphoto"])
That will let Shrine handle it seamlessly for you.
You can use
request.domain to check the current domain and query your database for the account & logo you need to show.
Check out what DMARC is, it's the reason your emails are being blocked. https://dmarc.org/
Basically, they're not allowing these emails because they know they didn't originate from the correct server(s). That's what an attacker might do to spoof emails for phishing and things and they think you're doing the same thing.
Sendgrid's servers aren't used for mail.ru, so you can't send an email from there. If you want to send an email from a mail.ru address, you'd have to do it with mail.ru's SMTP servers. Same with GMail.
Generally, you'll want to use your own domain for Sendgrid and other transactional email providers. That's what they're designed for. Make sense?
It's definitely stable. GitHub and Shopify are often running these versions (or even newer) in production. Rails 6 has been out for many months and 6.0.3 is just a bugfix release to fix some minor issues.
Posted in Cookie Replay Attack
Rails guides talk a bit about how you solve this: https://guides.rubyonrails.org/security.html#replay-attacks-for-cookiestore-sessions
@Tommy, importing images from CSVs would be as simple as assigning the image to the record using the URL from the CSV.
For example, Shrine's remote url plugin would be all you'd need. https://github.com/shrinerb/shrine/blob/master/doc/plugins/remote_url.md
If your uploader doesn't support url uploads, you'd need to download the image temporarily using like OpenURI in Ruby and then assign the file object to the record before saving.
I've been recording an update series in Rails 6 that should be out soon. :D
I know right?! Seriously amazing people here. Welcome to the group! 🤓
I think it's all an implementation detail of the database you're using. From https://www.postgresql.org/docs/current/queries-order.html
A particular output ordering can only be guaranteed if the sort step is explicitly chosen.
You've probably just gotten lucky with SQLite, etc, in the past. 😅
I think it's reasonable to include the sort order in your tests that way you can make sure both result sets are matching.
Or use something like
difference which would compare for the same items regardless of sort order. https://ruby-doc.org/core-2.6/Array.html#method-i-difference
Really depends on what you're trying to verify in the tests. If the order doesn't matter, no difference between the two arrays would be a good alternative assertion.
I believe Postgres preserves insertion order for simple queries, but when you start getting into more complex
where conditions and things it will not. Always good to specify an order if you're expecting a certain order in your results. 👍
Not quite yet. For example, I'm trying to build a Trello clone with Stimulus Reflex right now. Everything works great, however when I try to broadcast updates to other browsers, that's going to blow away any editing the other users might be doing. I'm talking with Nate tomorrow about it so hopefully I will have some answers. For right now, it seems real easy if you're just wanting realtime updates for a single user.
Exactly. Serialize the whole form and send it over to SR. Stimulus controller would make that the easiest, naturally.
The optimism gem is already built to do that btw. https://github.com/leastbad/optimism
Nah, you'd just add those queues to Sidekiq, delayed job, etc.
Make sure your background workers are processing the
Honestly, I'd just recommend using stimulus-flatpickr as it will do the setup/teardown automatically for you when Stimulus connects. Makes for very simple Turbolinks compatibility.
As for just fixing the flatpickr instance when it renders cache, you're exactly right. That's what you'd want. It will make sure it tears down before Turbolinks caches the HTML and that's exactly what you need.
Stimulus makes it a piece of cake, so I've started moving to creating Stimulus components that do the setup/teardown rather than listening to turbolinks events. It works with Turbolinks, with the additional benefit that it will also setup/teardown whenever you dynamically add HTML to the page from an AJAX request or websocket which is really nice.