Chris Oliver

Joined

247,110 Experience
18 Lessons Completed
271 Questions Solved

Activity

Posted in [SOLVED] Decrypt S/MIME 'file.xml.p7m' with OpenSSL

There's a Ruby package for OpenSSL you can use so you don't have to run shell commands. https://github.com/ruby/openssl

Devise has an user.update_without_password(params) method you can use. Might do what you need.

The defaults are also manipulated by the load_defaults method which can tell Rails to use the defaults from a specific version of Rails. Could be something with that maybe, I'm not sure. https://guides.rubyonrails.org/configuring.html#results-of-config-load-defaults

Posted in GoRails Design

Hey Rajan, no plans currently. Mostly for a static template you would just extract out the layout into application.html.erb and then replace static portions with ERB code to make them render what's in the database. Nothing too special.

Posted in CSS Beginner Need Help

You also have a triple ... which may be a typo and you meant ..

In the asset pipeline, you have to reference files using the asset helpers so they can be found in production. You would do image-url('bgimage.jpg')

https://guides.rubyonrails.org/asset_pipeline.html#css-and-sass

Posted in New website design!

Thanks guys!

@Matthias, the main reason to move away from Bootstrap is that while it's good to get something up quick, it's really hard to undo all their styles to build something custom with it. At a certain point you might as well build it from scratch. Since Tailwind works in reverse, you can implement virtually any design without having to write custom CSS which is nice. Check out Adam Wathan's videos on YouTube where he re-implements several popular sites like Coinbase in like an hour with Tailwind. Really great tool if you want to implement your own designs. TailwindUI is great for kind of bridging the gap between Bootstrap and Tailwind. That's what I used here.

Posted in New website design!

It took me several weeks to redesign everything and it was a TON of work. The main chunk of work was moving from Bootstrap to TailwindCSS and that's quite a lot of effort because you have to rewrite basically every line of HTML and re-implement all the Javascript functionality for modals, tabs, etc. It's finally complete enough to launch, so I'm super excited! 🙌

If there's anything I missed, please let me know!

Probably need to find an alternative gem or approach since Draftsman isn't being maintained anymore.

Posted in In-App Navbar Notifications Discussion

Yep, although it's a bit tricky. You would probably want to do this in ruby, and loop through each notification to see if the next one is the same as the last and then you can build up those into a group to display.

Been thinking about covering this at some point, but haven't gotten to it yet.

Rails will always use fingerprinted files in production, nothing fancy there. You just need to make sure the URL it's looking for matches a file in your current deployment directory on the server.

Does the route the browser is looking for match the filename assets/application-af01d6a4cd32bfcf9b8c41fa5fd1f1501cba6e3953ea8ff518309d0b7a8614c9.css

Those files are served up directly through NGINX, not Rails, so that's where you'd want to be looking.

Posted in Group Chat with ActionCable: Part 7 Discussion

Update to this series is in the works. :)

Posted in I tried to align this TEXT center.

Flexbox makes centering things vertically and horizontally really easy. I reference the TailwindCSS docs regularly for that. https://tailwindcss.com/docs/justify-content/#app

Devise hashes passwords and stores them using bcrypt by default. Looks like that may be replaced with clearance_sha1.

That's stored in the encrypted_password column in the database table. If you implement the same hashing algorithm, you can validate them against that column.

Hey Craig!

Check out this episode on Rails credentials. This is what I strongly recommend as all your credentials are easily organized and encrypted. Then in production you only have to set RAILS_MASTER_KEY to decrypt the file. Much easier to manage this way.

https://gorails.com/episodes/rails-5-2-encrypted-credentials

Posted in Direct File Uploads to S3: Part 3 Discussion

I haven't done direct uploads with Shrine v3 yet, but that's on my todolist.

Posted in How do I properly use the delegate method?

Exactly. And if you need to rename it or make it more complex, delegate can still let you call reservation.name even though it might delegate through a few objects if you had to add like approvals or some other model in the mix that made things more complex.

Posted in How do I properly use the delegate method?

Yep, that could be a good use case. I use it frequently for things like that. It's not really any different than saying reservation.customer&.name though with the new Ruby safe operator. It's basically doing that for you in the delegate method, but delegate will let you say reservation.name instead of having to know the customer lives in between.

Posted in Did I forget to do a migration?

Hey Christopher,

path helpers like profile_path are not methods on the User model. You can use <%= link_to "Profile", profile_path %> in your view to link to a route that matches that name.

The Rails guides would be a good place to read through how they work: https://guides.rubyonrails.org/routing.html#naming-routes

This doesn't (and shouldn't) have anything to do with your database. The error makes it look like that because you were trying to call a method on a database object.

Posted in Devise Masquerade as another User Discussion

Depends on how you're doing authentication. If you're using session cookies, it'll work out of the box. Otherwise you'll need to build your own mechanism that works similarly.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.