Activity
Yeah, Faraday is great, especially for making gems, that way you can easily swap out the backend library that makes the HTTP requests.
Like the error message says here, you're missing jQuery. Add jQuery to your app and you'll be set.
I'm hoping they release an update that fixes this soon! I've hit this a few times myself and am always surprised this is an issue. Thanks for posting the solution!
Posted in Best way to start a rails project?
I would definitely recommend using Devise for authentication for several reasons.
1) You're more likely to have security issues if you build authentication yourself
2) Devise has lots of users so they find security problems, but only hackers and yourself will be testing yours
3) Devise gets lots of updates for new versions of Rails, etc because of how many people in the community use it
I typically start with models and then create controllers. You want to have your database designed correctly before you implement your controllers. Since they are deciding how data gets saved, you need your models setup so they have somewhere to save.
You need to have your callback using a fat arrow =>
instead so it keeps the scope.
success: (data) => {
this.message()
this.doThingWithData(data)
}
That will retain the scope so that this
refers to the Stimulus controller. That will fix your method call error.
Posted in Why have the three dots syntax?
The triple dots are called the object spread operator. Basically it allows you to expand variables in useful ways to simplify the code you're writing. Here's a couple articles about it:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
https://medium.com/@oprearocks/what-do-the-three-dots-mean-in-javascript-bc5749439c9a
Posted in Creating an application Multi Language
Hey Kelvin,
I'm not too familiar with it, but you might try this gem: https://github.com/globalize/globalize
It can help you on the ActiveRecord model side to handle languages using a translations table it looks like.
Thomas, the Stripe series is new a separate course from GoRails: https://courses.gorails.com/payments-with-rails-master-class
It covers the latest Stripe with a shopping cart example for one-time payments, Stripe Billing subscriptions. Soon it will have Braintree + PayPal examples in the course as well.
You would probably need a multitenant plugin for Spree to do that.
Looks like there are a few gems for this:
https://github.com/spree-contrib/spree-multi-domain
https://github.com/spree-contrib/spree_shared
I haven't used Spree in years, so hopefully that helps point you in the right direction!
One thing to note: you would use Puma OR Passenger, but not both. Apache can proxy requests over to Puma, or you can have it send requests to Passenger. It's definitely easier to use Passenger because you don't have to have another process running.
Rails comes with Puma by default now to support web sockets in development, and you could also run Puma in production, but you have to run it as a separate background process with SystemD.
If you're using Passenger, you don't need to do that and you can just define the Server in Apache to have it load it.
When you say you have no problem connecting when using Puma, do you mean by running "rails console"?
Also can you share the full stacktrace for your error?
Hey William!
Sounds like just a database connection issue. Puma may start up just fine because it doesn't care about the database.
You can more easily test the configuration by using the Rails console in production and seeing if you can query the database.
RAILS_ENV=production bundle exec rails c
> User.first
Chances are you'll just need to adjust your database.yml or if you're using ENV variables for production.
I don't know anything about TinyTDS, so if you can connect to the DB but it dies at some point, you might want to ask on their Github issues.
Posted in Setup Windows 10 Discussion
I don't use RubyMine, but according to this, you might need to point to the ruby version inside the .rbenv folder instead of the shim. That way rubymine can find the gems directory correctly.
You can read the post here: https://df.tips/t/topic/326/3
Posted in How to debounce ActiveJobs?
Possibly this with a supported backend queue? https://github.com/y-yagi/activejob-cancel
I think when you enqueue a job it gives you back an ID. You could probably save that ID to the model that's being processed and look for a match when the job starts to only allow that Job ID to do the processing.
Posted in application.html.erb Help
Anytime! Keep posting if you have more questions. 🙌
Posted in application.html.erb Help
Strange, maybe it got deleted somehow?
If you generate a new Rails app, you can just copy the file from that one and put it into your existing one.
Posted in application.html.erb Help
That should be in app/views/layouts/application.html.erb
You shouldn't keep the client id and secret in your codebase unless it's encrypted. That way if you shared your repo with someone, they wouldn't be able to steal access to all the user's social accounts.
If you're using Rails 5.2, you can put them in the encrypted credentials file by running rails credentials:edit
.
Posted in Contribute to a gem
Yeah, it can get a little weird sometimes. You might suggest a good feature, but they might not use it or know how it works which makes for a reason they might not want to accept a feature. Hopefully you'd be able to help out and maintain it, that's very helpful.
It's really common for them to come back with suggestions to improve the code. Especially because they have to maintain it, they want to make sure it's similar style to their existing code so it's easy to understand. It's usually a back-and-forth discussion about how to implement things which is great.
One of the most helpful things you can do to get involved is to help out on all the other issues reviewing other PRs or issues or documentation. Then the maintainer gets to work with you a bit and the rapport helps when proposing features.
An example of a PR discussion of new features is this one on Stimulus. It came from the original developers, but they want to see what the community thinks and if it will be helpful or not. https://github.com/stimulusjs/stimulus/pull/202
Devise + Omniauth is typically the easiest route. Devise will handle the regular email logins and social auth via Omniauth.
I've done several videos on this.