python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
In Rails 4, how do I reference an enum value when initializing my model?
I’m using Rails 4.2. It is not an option to upgrade at this time. I have this model
class OrderItem < ApplicationRecord
…
enum type: { data: “Data”, product: “Product” }
How do I initializ...
Dave
Votes: 0
Answers: 2
Validate existing records with overlap item ranges taking nil as infinite
I'm here because I've been looking around for some queries that could help to find existing records with overlapping item ranges but I couldn't find anything. Let's say I have a model named Cart. A C...
Emilio Contreras
Votes: 0
Answers: 1
Active Record: NameError (undefined local variable or method `attributes' for nil:NilClass Did you mean? attribute_names)
I recently migrated from Rails 6.1 to 7.0 and I keep getting the error when I try to sign up a user.
NameError (undefined local variable or method `attributes' for nil:NilClass
Did you mean? attribut...
john Elisat
Votes: 0
Answers: 1
Postgresql JSONB nested form ruby on rails
I have product as active record table and option_type as activemodel model. option types is an array of objects as follows,
[
{name: 'color', values: ['red', 'blue']},
{name: 'size', values: ['sma...
Hemant Patil
Votes: 0
Answers: 1