Activity
Thanks Foliwe!
Thanks Alex! I appreciate it so much. :D
Posted in Login with Facebook Discussion
Fixed!
You're welcome and thanks for the encouragement and the support!! 🍻
There's a couple options for this generally:
- You can do this in the registration controller right after a successful save.
- Or you can do this in the model after_create (which might be simplest). I'll show that one here:
class User < ApplicationRecord
has_many :likes
after_create :create_default_likes
private
def create_default_likes
# Create your likes here
[1,2,3].each do |id|
likes.create post_id: id
end
end
end
For the controller version, you'd basically do the same thing just after the if user.save
. If you use something like Devise, you'll have to override the controller to do that.
Posted in Looking to upload files to local file storage on server. Recommended best to handle multiple?
Okay great, and yeah each file upload gem is slightly different than the others so it can change the code you write just slightly which was the reason I asked.
Posted in Looking to upload files to local file storage on server. Recommended best to handle multiple?
Are you using Shrine?
Posted in Looking to upload files to local file storage on server. Recommended best to handle multiple?
That would be beacuse in your file_tag
you're not referencing your @post
instance variable since you only have a local post
variable there.
For links you will want to do a regular link_to:
<%= link_to "View File", @post.file.url %>
It's as easy as SSHing into your server and running sudo apt-get install cmake
.
If you're interested in trying out a new feature, I added Scripts at the top of the page and you can create little bash scripts to install things like cmake. You can create a new Recipe and paste that line into that and tell it to run on your server (as root, not deploy) and it'll install it for ya.
Agreed! Any other debugging topics you'd like to see?
Thanks Scott! 🍻
Posted in PDF Receipts not working
Well your snippet there was using @charge
which would cause that because you didn't set the charge variable (and you can't since the user has multiple charges. You want resources
plural because there are many charges and the user should be able to view each charge and the ID needs to be passed in to the charge_path
. If you use both those that I mentioned you should be good.
Posted in PDF Receipts not working
If the link is 404ing, then you either don't have routes, or your links are wrong. They should look something like this:
# config/routes.rb
resources :charges
<% current_user.charges.each do |charge| %>
<%= link_to "View Receipt", charge_path(charge, format: :pdf) %> # tried this, didn't work
<% end %>
Posted in How to deploy in Google App Engine?
That's a great idea. I've been meaning to look into Google Spanner and stuff anyways so I'll have to try this out and make a video on it.
Looks like there are several good options for running Rails on there: https://cloud.google.com/ruby/rails/
I found it easiest to just listen for the webhook and remove the subscription then. This makes it simpler so your code doesn't have to add in an exception for the case of a user who canceled but is in their grace period and so on. That said, it's not really significantly different to just cancel at period end and also record that data to the user's subscription. You should have both the period end timestamp to record and the subscription could be marked as canceled too. The only adjustment is to make sure that subscriptions in the grace period are still considered active.
Just for reference this all got sorted out in Slack for anyone reading this later on: https://gorails.com/forum/h...
LOL this is great. Slack regurgitation to the forum.
Posted in Looking to upload files to local file storage on server. Recommended best to handle multiple?
Yup, you just don't need to do the presigning but the Javascript library will still help you control multiple file uploads on the frontend.
This line is what uses the JSON response and Turbolinks to redirect to the team page: https://github.com/gorails-...
And you should keep Turbolinks, it's awesome. :P
Posted in Setup Windows 10 Discussion
Because compiling Ruby takes a lot of CPU power.