Activity
Posted in How do I get avatar.variant(resize: β200x200β) on Rails 5 to work using aws on production?
ActiveStorage URLs always go through your Rails app. That's how they generate the resize 200x200 on the fly without precomputing it. That's the primary downside to using ActiveStorage right now.
In a future version of Rails, they will have an option to use direct urls to AWS, but you can't do that right now.
If you want this feature today, you'd be better off using Shrine for file uploads.
Lockbox or attr_encrypted are great for that. You just define an encrypted column instead of your normal one and add a secret key.
I've never done it, but looks like you can do this: https://stackoverflow.com/questions/490908/paste-an-image-from-clipboard-using-javascript/4400761
Hahaha, I noticed that the other day. It won't capitalize, I couldn't paste. SimpleMDE is not very good on mobile it seems. Might have to replace it with Trix, but we lose Markdown support. :(
Hey Anthony,
After the user signs up through the referral link, you can add the free post to their account. That might just be a column on the user model to keep track of it, up to you.
Then you can check if the user has a free post and let them post. If they don't, redirect them to the pricing page. You probably have a before_action in your PostsController to redirect if not subscribed, so you can modify that to allow them through if they have a free post. Once they complete the Post, then they you can remove that column on the user so they can't do it twice.
Posted in Welp. They just let me go.!!
Oof, that sounds awful. Any company should expect that you have a month or two of onboarding as you get used to the product, how it works, and how the team makes decisions and implements things.
If a company is still on Ruby 1.9.3 and Rails 3.2 these days, then they've probably got some serious technical debt and don't know how to dig themselves out of it. That's a bad sign.
Sounds like you dodged a bullet!
Citus which is a Postgres company designed around supporting multi-tenancy always recommends using row based segregation. They've built this gem which I would highly recommend. https://github.com/citusdata/activerecord-multi-tenant
Posted in Scheduling Posts Discussion
CoffeeScript works just fine in Rails 6. https://github.com/rails/webpacker#coffeescript
You can just call the complete_referral! method anytime the user completes the steps you want. If you want to do that right after registration, go add that after sign up. π
Nothing special for that really. If you have two models, you have current_user
and current_admin
because Devise separates those out. Devise Invitable has a polymorphic invited_by
column, so you can pass in any object for that.
Your invite code would look like this:
User.invite!({ email: 'new_user@example.com' }, current_admin)
I just add a constraint around it in my routes.rb.
Posted in Rails Application Templates Discussion
Rails application templates only work for generating new apps, so you can't get any updates on an existing app with them.
You can read through the changes and apply them to your app though. It's a manual process instead but it will get you updated.
Posted in Jumpstart pro configuration question
Jumpstart Pro doesn't currently have any marketplace functionality. You could add it yourself separate from the payments that are built-in to Jumpstart Pro.
You'd use the stripe connect omniauth gem to let the users login with Stripe and then you would need to setup payments through Stripe Connect on your account that run payments on the user's connected Stripe account. It's been a while since I've done any of that.
That's something I'd love to add in the future, but not sure when I'll be able to get to that.
Really old post of mine that's relevant here. I bet it's the cookie domain you need to update in both apps. http://excid3.com/blog/sharing-a-devise-user-session-across-subdomains-with-rails-3
It's been quite a while since I've deployed it. If it's crashing on User.first
then I assume you need to maybe run a rake task to setup a User or create one in the Rails console first? Not real sure.
All the methods can be found in their docs: https://github.com/teamcapybara/capybara#the-dsl
Posted in Open Closed Principle Discussion
I definitely think you should raise some error, it doesn't have to be NotImplementedError. The main reason you want to do that is because it provides a clear explanation why something didn't work.
You don't want to assume people are going to read the docs and implement every method correctly on the first try. It's very likely that won't always be done perfectly. Raising the error helps guide the developer on how to properly implement their subclass which is very helpful. I don't use and IDE, but if there are benefits there, then that's another reason that makes it more intuitive to use for other developers.
Yeah, should be. I have been using my own fork of it too. https://github.com/excid3/jumpstart
You'd just use the Heroku action as the last step I believe: https://github.com/actions/heroku
Yeah, should be able to set it up without Users. That's what guests are anyways, they don't have a User. You can always ask on the GitHub issues for it and get tips from the author. π