Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

Posted in how to move existing body content to use action text?

Yup, I had the same thing. I want to convert the GoRails forums over to it but now I'm like shoot...this is gonna be a lot of work to get right.

Posted in how to move existing body content to use action text?

That's a good question. I believe you'd have to convert your old content to HTML, then save it in the associated has_rich_text object. ActionText has its own model, so you would just create that record and that should make it available.

I haven't done this, so I don't have any code to point you in the right direction unfortunately.

Posted in Pipe convert out to Convert Input Minimagick

With a gem like image_processing, I believe you would just make two calls to do this. The first would want to save the output to the file so that the second could operate on its output. That way you won't have to use pipes in Ruby.

Very cool!

Since these aren't subscriptions, I don't believe you will be able to use Stripe Invoices or any of those features. Those I believe only work for subscriptions, so I guess that you will want something like this instead:

  • Reservation model with the due date.
  • One (or more) Payments related to the Reservation. This way you can keep track of the deposit and the final payment related to it.
  • Create the reservation after the payment is successful.
  • Email them reminders in a cron job about their upcoming due date and remaining balance (if any).

That's probably what I would do. Nothing too fancy.

What happens if they don't pay the balance? Do you just remove their access or something?

If these are subscriptions, Stripe Invoices have a "days_until_due" option. https://stripe.com/docs/api/invoices/create#create_invoice-days_until_due

If they're not subscriptions, I would just create a record to keep track of the order and the due date. If the current date is past the due_date, then you know it has elapsed.

You can then use a cron job to email the user warnings if it's 7 days till deadline, etc.

Twilio is a lot of fun. 🤓

Posted in Testing Controllers that call an activejob

Yeah, which is why my guess is that your test suite is referencing the wrong thing somewhere when it's trying to replicate the same thing.

Posted in Testing Controllers that call an activejob

Maybe you just forgot to change uninitialized constant Api::V1::ControllerName::JobName to match your class name?

There are lots of different types of notifications. A browser Notification in Javascript requires the user to be on the page. Email notification does not of course. Mobile typically requires a mobile app is installed and registered for notifications.

I'm fairly sure that mobile browser web push notifications in Javascript don't go through when the user is off the page. You'll probably need to do some research on that.

You can always send SMS or Slack notifications so the user would receive the messages through another form.

Posted in Ruby get GET request data

Jim,

You have to render a response through Rails. A puts is only going to print to the terminal. This doesn't work like PHP where it runs inside the HTML output, you have to actually build up the output in the response before Rails packages it up and sends it back.

If you're trying to render the URL params back out in the response, you would do:

def data
  render json: { 
      start_date: params[:start_date] 
    }
end

Posted in Hatchbox Postgres Problem

I logged into your server and restart postgres and your deploy succeeded now. sudo systemctl restart postgresql will restart it over SSH.

Posted in Hatchbox Postgres Problem

You should use the Hatchbox support link instead of posting in the GoRails forum.

Sounds like Postgres isn't running. Hatchbox doesn't fully manage your Postgres server for you, but it will install it and start it up.

I checked out your server and Postgres crashed because your server ran out of memory. You may need to upgrade to the next server size.

Hiding vs removing the tag in the HTML doesn't really make any difference. Just have to make sure that only admins are allowed on the server side of the request.

Posted in Question About Railties, rails repo and rails gems

It is a bit strange, but yes, they do use it as a monorepo. All the code for ActiveRecord is in the activerecord folder and so on. Each of those folders is a gem and gets published along with the Rails release. https://rubygems.org/gems/activerecord

The reason they do this is because they have to coordinate releasing all these gems at the same time with each new Rails release. This helps keep things consistent since they can keep track of it all in one place. Rails 6.1 can release updates for every gem with one command since it's all in the same repo.

I like app/validators. You can easily add in more there as needed and it's nicely organized. 👍

Posted in How do I style select options?

I think you have to use a Javascript library to create a custom select box like that. The browser's select box does not allow you to do that.

For example, something like this provides a ton of flexibilty: https://joshuajohnson.co.uk/Choices/ or https://slimselectjs.com/

Posted in Phusion Passenger error on Hatchbox

You can use -n 300 to with tail to display 300 lines of logs. By default it only shows a small handful.

Posted in Phusion Passenger error on Hatchbox

Is there more to the stacktrace? This doesn't look like a complete one.

Posted in How do I resolve this syntax error

Presumably you meant options to be a hash? You used () instead of {}

options = {
  stripe_id: customer.id,
  stripe_subscription_id: subscription.id
}

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.