Simplify loop using any?, all? and none?
Ruby has some useful methods for enumerable (Array, Hash, etc), this post will talk about usage of any?, all?, and none?.
Ruby, Rails, Web dev articles
Ruby has some useful methods for enumerable (Array, Hash, etc), this post will talk about usage of any?, all?, and none?.
If you are working on an app that has user generated content (like blog posts, comments etc), there might be scenario where it is too long to display and it would make sense to truncate them and put a “read more” button below it.
Here’s a method I encountered recently at my work and I found it might be useful to you as well.
How to get started with TailwindCSS
If you have been writing Ruby / Rails code for a while, but still can’t grasp on the ‘why’ to write automated test, (eg. why do so many Ruby dev job posting requires automated test skill like Rspec, minitest etc? How does writing automated test makes me a better developer or help the company I work with? )
I was working on a feature for my Rails app, which allows merchant to set fulfillment times on each day like this :
How to run tests in parallel in Github Actions
Sometimes for security purpose, or you just dont want users to share their accounts, it is useful to implement a check to ensure that only one login (session) is allowed per user at the same time.
TailwindCSS v2.0 was released on 19 November 2020 🎉, but it had a few changes that requires some tweak to install and use it on Rails 6, such as the requirement of PostCSS 8 and Webpack 5. As of current (10 December 2020), Rails 6 comes with webpack 4 and PostCSS 7, which doesn’t match the requirement of TailwindCSS v2.
Most of the time when we implement API endpoints on our Rails app, we want to limit access of these API to authorized users only, there’s a few strategy for authenticating user through API, ranging from a simple token authentication to a fullblown OAuth provider with JWT.