Activity
I'll have to boot into Windows and see if I can replicate that. What a weird problem. I'm also possibly going to swap out Trix editor anyways because it's not the best for syntax highlighting.
There isn't really a Rails way of doing things because Rails refuses to get too involved in the client side JS. I came from Python before I started Ruby and had the same sort of struggle. It's not common to have a whole bunch of options to tackle things in other communities!
There isn't really a Rails way of doing things because Rails refuses to get too involved in the client side JS. I came from Python before I started Ruby and had the same sort of struggle. It's not common to have a whole bunch of options to tackle things in other communities!
Hmm, spaces are working for me. Your post looks like you were in the code mode though.
You'll need an autocomplete or select library and then you'll need a JSON endpoint to gather the filtered records from. I did an episode on autocomplete here: https://gorails.com/episodes/global-autocomplete-search and I covered Selectize here: https://gorails.com/episodes/select-or-create-with-selectize-js
Selectize has an option for "remote data loading" as they call it. They have a couple demos at the bottom here that use Github and Rotten Tomatoes APIs. https://selectize.github.io/selectize.js/
You'll need an autocomplete or select library and then you'll need a JSON endpoint to gather the filtered records from. I did an episode on autocomplete here: https://gorails.com/episodes/global-autocomplete-search and I covered Selectize here: https://gorails.com/episodes/select-or-create-with-selectize-js
Selectize has an option for "remote data loading" as they call it. They have a couple demos at the bottom here that use Github and Rotten Tomatoes APIs. https://selectize.github.io/selectize.js/
Hey Taylor,
One-off charges are basically the same as Subscriptions. You just create a Stripe::Charge object instead of a Stripe::Subscription.
1. Add Stripe to the Gemfile
2. Add the Stripe JS and checkout form to the page
3. The form for a new job should POST to the create action, so in there you can process the payment.
4. Handle the payment and job creation together in a transaction
One-off charges are basically the same as Subscriptions. You just create a Stripe::Charge object instead of a Stripe::Subscription.
1. Add Stripe to the Gemfile
2. Add the Stripe JS and checkout form to the page
3. The form for a new job should POST to the create action, so in there you can process the payment.
4. Handle the payment and job creation together in a transaction
def create @job = current_user.jobs.build(jobs_params) if @job.create_with_stripe(params[:stripeToken]) redirect_to @job else render 'new' end end
class Job < ApplicationRecord def create_with_stripe(token) if valid? # Charge the user's card: charge = Stripe::Charge.create( :amount => 999, :currency => "usd", :source => token, ) update(charge_id: charge.id) else false end rescue Stripe::CardError, Stripe::InvalidRequestError => e errors.add :base, "Whoops! We were unable to process your card. #{e.message}" false end end
This way your payment logic is nicely organized with your Job. You check if the job is valid first, then we can fail quickly if it isn't valid. Then if it is valid, we can create the charge, and then update the Job with the charge ID for refund / reporting purposes. And if Stripe's charge fails with an error, we catch that and add the error to the Job and return false. Then your controller is nice and simple and just has to check if the create with stripe method returns true or false.
Posted in RailsConf
I was really wanting to, but I don't think I'll make it this year.
Posted in How to update TailwindsCSS?
Pretty much you'd just update the version in your package.json and use yarn to install it. You'll want to check with the releases page and see if anything has been deprecated or removed and upgrade your code if so. Other than that, I don't think there's much else you'd have to do.
Posted in Tools
New section I'm rolling out soon! Accidentally published it too soon. :) I wanted a place to recommend gems (like which file uploading tool should you pick?)
Hey Juan, I would probably just SSH in and run those commands on the server in the app's current directory. You probably could run Capistrano tasks to do that, but SSH is probably easier.
You can get that error if you made a typo because it can't compile the file. Try checking your code for errors.
Posted in New server failed provisioning
This also happens if you used the 512MB server size. It still lists as available even though it is not actually. You can use a 1GB server for the same price and it will work fine too.
Yep, exactly.
Rough outline of how I'd build this:
1. Create a unique referral token for each user
2. Add the link to the UI for the user (link to the homepage with the token)
1. Create a unique referral token for each user
2. Add the link to the UI for the user (link to the homepage with the token)
<%= link_to root_url(ref: current_user.referral_token), root_url(ref: current_user.referral_token) %>
3. Create a before action on ApplicationController to set the referrer
before_action :set_referrer def set_referrer # Just store this for later, we will check this out during checkout cookies[:ref] = {value: params[:ref], expiry: 30.days.from_now} if params[:ref] && !user_signed_in? end
4. Then you can check for cookies[:ref] during checkout and apply the discount to the user accounts.
Probably the easiest solution for giving these coupons / discounts out is by simply updating each of the user accounts and applying a credit to each one. This way you don't have to deal with Stripe Coupons or roll your own subscription system.
Also, Stripe has a tutorial on using coupons that will be good to read through even though you may not use this: https://stripe.com/docs/recipes/coupons-for-charges
Probably the easiest solution for giving these coupons / discounts out is by simply updating each of the user accounts and applying a credit to each one. This way you don't have to deal with Stripe Coupons or roll your own subscription system.
Also, Stripe has a tutorial on using coupons that will be good to read through even though you may not use this: https://stripe.com/docs/recipes/coupons-for-charges
Yep, you'll just have to use the Custom VPS option and have your server created on Hetzner first.
And here you go: https://github.com/excid3/jumpstart
Hey Allison,
It's still a work in progress, but let me upload it and share it for you. I know several other people have asked and I just never really felt it was ready enough to share, but then anyone can help fix bugs. :)
It's still a work in progress, but let me upload it and share it for you. I know several other people have asked and I just never really felt it was ready enough to share, but then anyone can help fix bugs. :)
Posted in Condition if devise action view
I think it is:
<% if devise_controller? %>
Are each of these SSL certs in a separate file?
Are you restarting nginx with `nginx restart` or `nginx reload`?
I've never dealt with near that many SSL certs so that's certainly a new problem to me. I did find this blog which talks about handling 1022 sites and SSL certs with server configs: https://jeremyfelt.com/2016/01/16/managing-ssl-certificates-and-https-configuration-at-scale/ Seems like it has a couple tips that might help.
Are you restarting nginx with `nginx restart` or `nginx reload`?
I've never dealt with near that many SSL certs so that's certainly a new problem to me. I did find this blog which talks about handling 1022 sites and SSL certs with server configs: https://jeremyfelt.com/2016/01/16/managing-ssl-certificates-and-https-configuration-at-scale/ Seems like it has a couple tips that might help.
As far as Heroku goes, I had to add the nodejs buildpack to my Rails app so it would properly compile Webpacker with Ruby. You basically end up with both the Ruby and Node buildpacks and that gives all the Ruby and Node/Yarn versions required to get things going.
It's actually completely custom. I exported my Disqus comments and imported them into the forum. Then extended the forum to have nesting. There are still a few warts here and there because it's doing double duty for comments and the forum, but I'm going to try to clean those up tomorrow.
Make sure you're using rails-ujs and have it included in your asset pipeline. It was introduced in one of the newer versions of Rails to remove jQuery. If you're on an older version of Rails you can either upgrade or change the Rails.ajax to jQuery's version.
Hey Jacob,
Those files are from the new bootsnap gem. They're caching your application's require paths and things in a binary format so your app boots WAY faster. You don't need them stored in your git repo.
Those files are from the new bootsnap gem. They're caching your application's require paths and things in a binary format so your app boots WAY faster. You don't need them stored in your git repo.