will

Joined

11,310 Experience
101 Lessons Completed
1 Question Solved

Activity

Posted in Subscriptions with Stripe Discussion

Is this episode still up to date with how stripe works? It doesn't seem the same as the docs:
https://stripe.com/docs/billing/subscriptions/fixed-price

Hi Chris. CORS isn't enough in this case. I'm hitting quite a few issues with ITP (https://webkit.org/blog/9521/intelligent-tracking-prevention-2-3/) on safari, and that is soon going to be an issue on the other browsers. That is workaroundable with Storage Access API, however when users open sites within a facebook/instagram/whatever type app, the site is opened in a WKWebView which doesn't like cookies at all and I don't think can be worked around. Hence the thoughts around using tokens. My current plan is to use shortlived tokens that are added to all the site links. Which sounds very not secure.

I want to implement a cookieless sessions part of my site. It runs in an iframe and cookies are causing a lot of problems. Would JWT auth be good for this? The main stumbling block i think is secruity. Is it safe to write the token into the links on each page so that the token is passed on each request? It seems like that wouldn't be secure as hackers could grab it and use it to login.

Posted in File uploads in Rails with Shrine Discussion

Can Shrine make files secure? Ideally, selecting which file attachments are secure and which are public should be possible. Currently hard to do with ActiveStorage as you have to select it for all the attachments. Which is quite Basecamp centric in it's thinking.

Posted in Introduction to Stimulus Reflex Discussion

I like it!

notes on the new site design:

the completed tick needs to be heavier font, i can't really see if it's green.
set alt text on the buttons, i don't know what they all do. what does the text one do? alt text could also confirm completed status.

Posted in How to test ActionMailer in Rails Discussion

Cool, thanks. I've been using mailcatcher, which is great for developing but you have to reload! in the console to get changes in the templates to show up. Previews looks much better.

@chris That wiki is talking about scoping based on a string attribute on the user model, right?

So we would have to set up the system to user the account model reference, which isn't set on the user model here, because it is a has_one relationship.

Big piece of the puzzle missing here.

Posted in Multitenancy with the Apartment gem Discussion

that looks great. will you be using that with jumpstarts multitennancy features?

Posted in Notifications for ActionText User Mentions Discussion

Great tutorial as always chris.

In your repo, you have some code for a video embed custom Are you making a tutororial about that?

It would be great to figure out how to add things like a link dialog that retrives links from the site models, an image dialog that fetches from a media model etc so that ActionText could be used as a basis for things like CMS / eCommerce content editing rather than it's current focus, which seems to be comments systems.

I made a start with this, adding h2, h3 and underline elements. I don't know if this is the right way to do it but:

https://stackoverflow.com/questions/58805984/add-buttons-to-rails-actiontext-toolbar/58807418#58807418

Is there a way to add / delete buttons from the tool bar for action_text? For eg, I'd like to add more semantic header levels (h2-h4).

Posted in Sortable Drag and Drop Discussion

Hay Jaymarc,

run
yarn add jquery-ui

then in your javascript/packs/application.js

require("jquery-ui/ui/widget")
require("jquery-ui/ui/widgets/sortable")

$(document).on("turbolinks:load", () => {
  $("#questions").sortable({
    update: function(e, ui) {
      Rails.ajax({
        url: $(this).data("url"),
        type: "PATCH",
        data: $(this).sortable('serialize'),
      });
    }
  });
})

... and the rest is the same as the tutorial, minus all ui gem. hth

Posted in Sortable Drag and Drop Discussion

plus 1 for this.

Posted in How to write System Tests in Rails Discussion

In the gem file you have included capybara, how much is that used here and how much is just minitest?

--

Before posting I did some looking : )

System tests allow you to test user interactions with your application, running tests in either a real or a headless browser. System tests use Capybara under the hood.
(https://guides.rubyonrails.org/testing.html#system-testing)

..and the default install of a new rails app comes with capybara etc set up in gemfile and application_system_test.rb etc.

Is there a good, focused cheatsheet / resource with all the main methods available when using capybara with minitest in rails?

Posted in Test Driven Development Basics Discussion

Posted in Test Driven Development Basics Discussion

+1 for minitest & fixtures over rspec, factorybot etc This is nice.

Posted in Multitenancy with the Apartment gem Discussion

Looks like the gem currently has no active maintainers

https://github.com/influitive/apartment/issues/591#issuecomment-478746238

Posted in Multitenancy with the Apartment gem Discussion

What do you think about the performance issues highlighted in the gem author's blog?

https://influitive.io/our-multi-tenancy-journey-with-postgres-schemas-and-apartment-6ecda151a21f

I think there is a note that relates to the way rails was analysing the schemea for each tennant causing bloat in the readme, so maybe that is fixed now. But what about the postgres issues that they / heroku had issues with. Is apartment gem ok to use for > 50 users?

Can anybody point to some resources of using this with an array in a jsonB column

So For eg, if data was like this:

 equipment_required :jsonb

> Report.first.equipment_required
=> 
[
{"name"=>"Brushwood Chipping", "size"=>"6\"", "type"=>"Wheeled", "quantity"=>"1", "hours_required"=>"2"}, 
{"name"=>"Tipper", "type"=>"Normal", "quantity"=>"1", "hours_required"=>"2"}
]

Great episode. How Trix works has become a little bit clearer. Thanks!