In this post, we will see how to resolve (Rails 6 specific) How to validate a date for future events only? Question: In rails 7 I could use the ComparisonValidator and make my life easier, but I have a project ...
In this post, we will see how to resolve Is there a way I can force a record to not be destroyed when running a feature test in RSpec? (Rails 6) Question: For context, I have a controller method called ...
In this post, we will see how to resolve How to check status with a rake task Question: i’m trying to make a rake task to run it with scheduler on heroku, but first im testing locally so i have ...
Question: devs i’m trying to schedule some posts in my blog module, its a simple scaffold posts, this is my schema.rb I Put that published attribute in my model for a reason, to evaluate if the user when entering the ...
Question: When rendering a rails active storage image variant as follows: The image gets flipped upside down. I have tried to remove the EXIF metadata by setting the auto_orient option as true like suggested here without success. This is definitely ...
Question: I’m using Ruby on Rails 6.1.4.4. I want to override a method in a gem, whose signature is this So I tried creating a file, lib/ext/acts_as_commentable_extensions.rb, and including this code Although the first statement prints out the correct source ...
Question: How can I access my related records? PostCategories table has id, posts_id, and categories_id columns. What I want is: to get posts related to a category. like: all Posts where in x category. Answer: Yep, this is an easy ...
Question: If we’ve models as: with routes: and we want to create a form as: How could we create this kind of form (/books/:id/chapters/new) without setting the book id ? The example above will throw: In my case the user ...
Question: Briefly, here’s my associations: I’ve a view where 2 forms are displayed: one for adding a new Calendar, associated to a Team one for adding a new Event, associated to a Calendar In my controller, I set up variables ...
Question: I’m running a Rails 6 application from a Docker container. When I start my application, I get errors like this on the log How do I allow connections from any network? I don’t want to hard-code IPs because that ...