Chris Oliver

Joined

291,480 Experience
86 Lessons Completed
296 Questions Solved

Activity

Posted in How to get ngrok working with webpack-dev-server

Probably because you're using SSL to access your site over ngrok and your dev server is not. Try using http with ngrok.

Posted in Rails 6.0 + Heroku + Active Storage + VIPS

Whoops, misread Heroku as Hatchbox. The following would be how you would use VIPS on Hatchbox.io:

sudo apt install -y libvips libvips-dev libvips-tools

Posted in How do I manage business hours for a store?

Hey Taylor, I just built this for a project actually so I have some timely experience for ya. :)

Postgres has a Time column you can use that doesn't include a date. This works perfect.

The TimeOfDay gem you can use to serialize those time columns into a TimeOfDay object which is a time without a date. That comes in handy since that's what business hours really are.

We decided to setup 14 columns, a start and end time for each day of the week. You could also save 14 attributes to a jsonb column instead of 14 separate columns. Those two approaches would work about the same and you could query against either one.

As for the form, same as usual. You build a select field that selects a time, and submits it. Make sure the attributes are permitted and the TimeOfDay serialization will make sure it gets cast to a time in the database.

I made a little helper to generate a select options from 12am to 11:45pm every 15 minutes to make selecting times easier.

Posted in GoRails Design

Hey Anton! I bought a theme from Bootstrap's store and used that. 👍

Posted in JWT with Devise (App and API)

Oliver, yep. If you login on the web, you'll login with a session cookie. Otherwise you'll hit the API with a token and be logged in only for that request.

Posted in Unable to create the Rails app in WSL

Sounds like permissions issues and seems like other people have experienced that. Try this: https://askubuntu.com/a/1118158

Posted in Webpack assets doesn't work after deployment

Hmm, good to know. I'm not quite sure why that would be required, but at least you got your problem solved.

I haven't had to do that, but maybe there's something with the way your code is requiring things that makes it need that.

Posted in Webpack assets doesn't work after deployment

Nope, should be nothing to do with Capistrano.

Try running "RAILS_ENV=production bundle exec rake assets:precompile" on the server and confirm it compiles your webpacker assets.

The webpacker:compile step gets appeneded to the precompile, so you never need to run the webpacker command directly.

Posted in Webpack assets doesn't work after deployment

Okay, looks good. I can see the error now.

On your server, is there the matching filename from the error inside public/packs/ ? Seems like the file compiled successfully, so I would check and make sure the file exists on disk. Then you can tell if it's a configuration issue or something else.

Posted in Webpack assets doesn't work after deployment

The JS error link is broken there.

 DEBUG [1885af3e]   yarn install v1.12.3
 DEBUG [1885af3e]   warning package.json: No license field
 DEBUG [1885af3e]   warning No license field
 DEBUG [1885af3e]   [1/4] Resolving packages...
 DEBUG [1885af3e]   [2/4] Fetching packages...
 DEBUG [1885af3e]   info fsevents@1.2.7: The platform "linux" is incompatible with this module.
 DEBUG [1885af3e]   info "fsevents@1.2.7" is an optional dependency and failed compatibility check. Excluding it from installation.
 DEBUG [1885af3e]   [3/4] Linking dependencies...
 DEBUG [1885af3e]   warning "@rails/webpacker > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697".
 DEBUG [1885af3e]   warning " > webpack-dev-server@2.11.2" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
 DEBUG [1885af3e]   warning "webpack-dev-server > webpack-dev-middleware@1.12.2" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
 DEBUG [1885af3e]   [4/4] Building fresh packages...
 DEBUG [1885af3e]   Done in 24.61s.

This shows that it's running and compiling your webpack code successfully.

How are you including your packs in your layout?

Posted in Webpack assets doesn't work after deployment

You don't need to link app/javascript/packs. During precompile, it will run yarn and output the files in public.

If you're not seeing the files, then it's an issue with your precompile step. Do your capistrano logs show that it's running the precomile and does that step say anything about webpacker?

Posted in Webpack assets doesn't work after deployment

Like Ivan said, more information is important.

For me, I just make sure Yarn is on my server and it automatically compiles during the assets:precompile step. Simple as that.

That looks feasible to me. The one I've run into trouble with in the past is Faraday since many gems depend upon it. You might need to update some other gems to allow your Faraday dependency to update high enough. Might neet do the same for a couple other gems.

Posted in How to test attachments in ActionMailbox?

Thanks for posting the solution! I'm going to be covering this soon so I might use your example here. 🙌

This would be great. I'll try and do an episode on Uppy soon.

Posted in How do I remove Devise::Trackable from my app?

Yep, that should be it. You don't have to remove the columns, but you might as well if you don't need the data.

Thanks Monroe! It's been a heck of a lot of work, but these are the reasons that keep me going. 🙏

The Rails community is a special place. So many helpful people here, so I am thankful for all of you in the community who make this possible!

You'd just need to find a video player that will do it for you (that way you don't have to build it yourself).

https://www.jwplayer.com/video-ad-support/
https://cloudinary.com/product_updates/video_player_ads

There are several other options.

If you wanted to build it yourself, you'd first play the ad, then when it is finished, replace the video with your content. All that will probably be in Javascript and you'd need videos for the ads and such to serve up. And you'd want to collect ad metrics for plays and clicks, etc probably.

Hey Edmundo,

Oh yeah, great point. I believe you just set data-controller="tabs" data-tabs-index="1" to have it select the 2nd tab, but that would have to be rendered in the HTML.

We may want to add some other method of doing this too. Possibly looking at the anchor in the url and selecting the target with the matching ID.

Posted in How to use Action Mailbox in Rails 6 Discussion

Same way params is available to all methods in your controller. It's simply a method defined in the parent class.