
How do you create and save an Active Record instance that has a reference to itself?
0
Rails
`Files` is an Active Record model that has a reference to its parent of the same type:
```ruby
class Files < ActiveRecord::Base
belongs_to :parent, class_name: "Files"
end
```
I want to creat...
Perry Smith posted

custom sql in migration breaks in test env?
0
Rails
Hi. I added a migration with SQL to create a full text search column. Worked fine in development, but when I pushed, our git hooks tried to run the tests, and I got a pending migrations error.
I ...
Luke Gilliam posted

How do I #create with a double delegated_type and has_many :through
5
Rails
I have this marvelous complicated DB design that goes along these lines: events ( like calls, tasks, and meetings ) can have a number of assignees (Participants, and Assets) - like a Team Meeting c...
Walther Diechmann replied
Solved

rails user profile privacy
0
Rails
I have a devise User model and Profile model, the relation is User has one profile. I want the user to be able to chose what information about themselves to share with their friends only or with th...
Han posted

BCrypt: Can't validate passwords
1
Rails
I can't seem to get BCrypt to validate my passwords.
I'm trying to get back into rails with 7.
Can't seem to get passed password validation for my Admin:
As I understand it. It's a very straight ...
sweedledee replied
Solved

Ordering with included models
1
Rails
Is there a way to order results using a column from a model and a column from a related model via includes? Here is a scenario:
A product that has many parts, each of which has a numerical value a...
HP replied
Solved

How to delete parent object when last associated child is deleted?
1
Rails
I have a Family model that `has_many` Kids. I'm using `dependent: :destroy` on the family so when it is destroyed the associated kids are destroyed too. All good.
Now I need to destroy the family ...
Suleman Uzair replied

Devise and OmniAuth - correct approach?
0
Rails
Hello,
I decided to start building a social media scheduling tool as I figured it would be decent portfolio project for a junior dev. I'm a little confused as to how to integrate Users' social me...
Christian posted

API params validation in Rails app
5
Rails
Hey guys!
I'm wondering, what could be a good and scalable way to validate if API request is well formed, before processing it. Rails has strong params for that, but I have a case when an API endp...
simrel12 replied
Solved

With Hotwire and a long-running background job, how can I show a message indicating that data is loading?
1
Rails
So I have a long-running API call running in a background job. As records are created/updated/removed in that job I have them broadcasted to the user. I would like to have a notification/badge adde...
Solved

PDF generate
1
Rails
I am using PRAWNS gem and i need to know how to generate pdf using prawns in a rails project
runte damaris replied

Turbo Stream - dynamically replacing partial on the page
6
Rails
I have an edit user page that has multiple cards on it. I have each card wrapped in its own turbo frame tag with a unique id. On the update action in my controller if I just redirect_to @user the s...

Failed to run sidekiq properly to heroku
0
Rails
After deploying sidekiq to heroku, everything works properly except when I try to run a job I get this error Redis::CommandError: ERR invalid password
John Nonso posted

Issue when adding Confirmable in Devise - [ArgumentError - wrong number of arguments (given 0, expected 1)]
0
Rails
I've been setting up Devise Confirmable for my development environment Rails 5.1.7 app.
My initializers/devise.rb looks like:
Devise.setup do |config|
require 'devise/orm/active_record'...

How do I get Multiple Output files with cssbundling-rails and Tailwind.
1
Rails
It took me a couple of days to find this answer:
https://dev.to/nikz/multiple-output-files-with-cssbundling-rails-and-tailwind-3b4k
A Tutorial here might help.
Chris Oliver replied

How do I insert smart variables with a text editor?
5
Rails
I would really appreciate some insight to how you could let a user select from pre-definied variables in a dropdown and insert them into a text area; some people have mentioned saving a liquid and ...
Leon Entrup replied

CSRF logging me out
0
Rails
Rails 5, Ruby 2.7.
I'm getting the dreaded error "Can't verify CSRF token authenticity." and I'm being logged out and my tokens don't seem to match. This is happening on a new development machine (...
Bruce Lulu posted

Rails 6, Webpacker and Docker on Apple M1
0
Rails
Hi Chris,
I tried to leave a comment for episode #389 but was not successful. Not sure why. Anyway, I'm developing in Apple M1 and trying to dockerize a Rails 6 application, but running into a lot...
Gabriela Jack posted

how i can implement this functionality
0
Rails
Seller can perform CRUD on his/her listing(product i.e laptop)
Seller can upload multiple product images.
faheem ismail posted

Using find_or_create_by with accepts_nested_attributes_for
7
Rails
Hi gang...I have a Book which has_many :authors, through: :book_authorsInstead of creating a new Author each time I create a book I'd like to use find_or_create_by on the author's name attribute. R...
Solved