Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
40 views

"Rails: NoMethodError for Nested Attributes in Form Submission

Description: I'm working on a Rails application where I have a Picture model that has a nested Pictureclass model. The index (the gallery of pictures) and the show (a detail of the picture) are ...
coopeu's user avatar
  • 83
0 votes
1 answer
51 views

Defining translations for nested forms in namespaced resources

I have the below setup class BudgetLine < ApplicationRecord has_many :budget_line_items accepts_nested_attributes_for :budget_line_items end class BudgetLine::Accommodation < BudgetLine end ...
Magnus Remøe's user avatar
0 votes
2 answers
83 views

How can I select elements based on an attribute of a child of a parent element's previous sibling?

Is there way I can hide the 2nd and 3rd anchor elements inside the li elements using CSS? Also, it needs to be hidden based on the attribute selector "isInternalUser=true" which is there in ...
Sanju R's user avatar
  • 11
0 votes
0 answers
37 views

Rails unable to update multiple nested attributes at once?

I have a deeply nested attributes controller, like this: def update @product = Product.find(params[:id]) authorize @product if @product.update(product_params) render status: :...
Msencenb's user avatar
  • 5,104
1 vote
1 answer
36 views

Unpermitted Parameter error in Rails for nested nested form submission

I'm trying to create a quiz builder where a user builds a quiz that is added to the Quiz model, a question that is in the QuizQuestions model and answer choices in and AnswerChoices model. The Quiz is ...
auto's user avatar
  • 1,123
1 vote
0 answers
44 views

Keep nested attribute's values to show validation errors on form submit

I have a model Parent class Parent < ApplicationRecord has_many :jobs accepts_nested_attributes_for :jobs, allow_destroy: true end and model Job class Job < ApplicationRecord belongs_to :...
Imanpal Singh's user avatar
0 votes
1 answer
75 views

Unpermitted Params using Polymorphic Association in Rails 7

Based on image above, I do a simple example. Model: Person class Person < ApplicationRecord belongs_to :personable, polymorphic: true end Model: Customer class Customer < ApplicationRecord ...
Saulinho's user avatar
1 vote
2 answers
87 views

Rails form for not creating unique ids

This is driving me crazy. I have 2 models, StockShipment has_many Recipients. It also has: accepts_nested_attributes_for :recipients, reject_if: :all_blank, allow_destroy: true I have this partial, ...
user3074558's user avatar
2 votes
1 answer
241 views

How to automatically assign parent ID as foreign key when using nested attributes?

An action creates records based on multiple layers of nested attributes, upon the submission of a form. However, the ID of the root record, which I call .save on, is not propagating downwards to the ...
Raphael Müller's user avatar
0 votes
1 answer
68 views

Displaying information from unrelated nested models

I'm building a Rails application with two models, both with a further two nested models: Contacts -> Trackers -> Emails and Goals -> Stages -> Templates I want to display information from ...
Cat Morley's user avatar
0 votes
1 answer
2k views

Ransack, unable to search two attributes

I'm a beginner trying to make a searchbar, i'm with a simple attribute research, works fine, but when i try to add another attribute in the search_field, i have an error : "Ransack needs Product ...
samuel bellotlecoq's user avatar
0 votes
0 answers
25 views

Rails flexible checklists

I need advice if my approach is right I would like to create a digital checklist for several test types with the possibility that users can add further questions to the checklist at any time. I have ...
Christian Schumacher's user avatar
2 votes
1 answer
153 views

Rails: creating nested attributes with manually set IDs

I have a rails API that injects primary key IDs from the client, as opposed to autogenerating through Rails. Specifically: class ParentModel < ApplicationRecord accepts_nested_attributes_for: ...
PlankTon's user avatar
  • 12.5k
2 votes
1 answer
825 views

how to translate Nested Attributes on laravel validation?

I have a problem translating nested attributes on laravel validation, the code im using is like: $this->validate($request,[ 'title.*' => 'required' ]); and * can be: en, es, fa ... and other ...
Kowalski's user avatar
0 votes
1 answer
120 views

Nested fields in form is not rendering

Im new to ruby on rails so i need some tips please. Im trying to render some checkboxes on the edit view for a user. I have tried to follow the documentation for the nested_attributes but the ...
Webie's user avatar
  • 33
0 votes
1 answer
29 views

Display value within top level document of nested document field value in mongoDB

This is the document from where i wanted to pull data from { "_id" : ObjectId("635cbfee36945e4a79b0af70"), "EID" : 200, "EName" : "...
Radhey Yadav's user avatar
1 vote
1 answer
381 views

nested attributes with has many through

I am getting unpermitted params when I am passing values from UI. The association is many to many between models. class User < ApplicationRecord has_many :user_posts has_many :posts, ...
Aniket Tiwari's user avatar
1 vote
0 answers
102 views

Working with Form Object and nested attributes: Couldn't find JoinTableRecord with ID=1 for Parent with ID=

I'm working on a form object where I build and save an instance of Service, but I'm having a hard time building and saving nested records. A Service has_one features_set and ...
pinkfloyd90's user avatar
-2 votes
3 answers
299 views

Filter according field on array object

I have an object is data like this : Original data const data = { "title": "sunny", "members": [ { "fullname": "rozo", "customers": [ { &...
Zoro123's user avatar
3 votes
3 answers
1k views

Alternatives to attrdict library for nested AttrDict

My program contains a lot of configuration parameters so I was looking for a way to have them all in one place, accessible from every file in the project. I thought about a config module which would ...
Wippo's user avatar
  • 953
0 votes
0 answers
62 views

How to setup this complex nested attributes hash

I have product, feature, product_feature, and quota. # product.rb has_many :product_features, dependent: :destroy has_many :quotas, through: :product_features has_many :features, through: :...
Matthew Berman's user avatar
0 votes
1 answer
66 views

Rails: Cannot set the value of text_field with jquery

I am trying to update the value of an item codenumber field every time the user selects an item from a list using jquery. My view is like this. <tr class="nested-fields"> <td ...
kouroubel's user avatar
  • 280
0 votes
1 answer
329 views

Nested parameter does not include <name>_attributes in Rails 7 when submitting nested attributes

I'm facing this issue and after digging, I can't seem to find a solution for this. I'm trying to create a user and his meet_infos on a nested form, but in the params, I always end up with "...
Amine BEN TALEB's user avatar
1 vote
1 answer
197 views

Building new Model A form from Model B attributes

I'm trying to copy the values from Model A nested attributes to Model B nested attributes. The nested fields are the same in their respective tables. Just the parents are different. I pass the model A ...
Chrismisballs's user avatar
0 votes
0 answers
34 views

Create multiple associated records in a single form [duplicate]

I'd like a User to be able to create an Event and associated Invitations. An Invitation is a join table between User and Event (with an enum for its state, default to pending). Eligible users are ...
Sumak's user avatar
  • 1,021
1 vote
2 answers
82 views

Is there a suggested way to create nested many-to-many entities in RoR that avoids *_attributes in the JSON field for the nested resource?

I've managed to get nested many-to-many entities created through the use of accepts_nested_attributes_for for the JSON and the project below. My question is - is there a suggested way to achieve the ...
foamroll's user avatar
  • 793
1 vote
1 answer
977 views

How to get data based on condition from nested array golang grpc service

I'm trying to get specific data based on next array condition in Go. I think, I will just give an example to make it clear. Let's say I have an array like this detail: { contacts: [ { ...
Aethereal's user avatar
  • 183
0 votes
0 answers
147 views

Rails nested attributes method delete not working correctly

I have two models: Article and Paragraph. One Article can include much Paragraphs. Article model: class Article < ApplicationRecord #enum category: {wiki: "Wiki", rules: "Rules&...
omni395's user avatar
0 votes
0 answers
279 views

Create child association from controller

I have 2 associated models and am trying to create the child from the parent's controller: class Purchase < ActiveRecord::Base has_many :comments, as: :commentable, dependent: :destroy ...
Jeremy Thomas's user avatar
0 votes
0 answers
22 views

Saving Paginated child only when Parent get saved in Rails

I have application with form containing Parents with its Child rendered through Nested Attributes in view for edit. Take example of Hr trying to edit an employee details along with his skill ratings. ...
Arun Yadav's user avatar
1 vote
0 answers
100 views

How can I accept array params inside a nested form?

I'm making an app where users can create and edit Surveys with a number of Questions. Instead of an Answer class, I am serializing the possible answers for each Question as an array in a column named ...
Stack Overflown's user avatar
0 votes
1 answer
441 views

Update nested attributes objects independently from parent model

I have a parent model 'page' and nested attributes model 'page_modules' which at same time are modeled by 'Single Table Inheritance' pattern. My problem is when I try to save different generated '...
Sahu's user avatar
  • 183
0 votes
1 answer
942 views

Rails form with nested attributes in has_many through relationship

I'm attempting to build a form with multiple nested objects in a has_many :through relationship. However, the nested objects do not appear to be getting assigned the foreign_key of the parent object ...
Tony Beninate's user avatar
0 votes
1 answer
398 views

Filtering nested attributes in rails API json output

Im building an API in which i have a model called Studio. Studio has many movies and many series, and movies and series have many characters of their own. Also, a character can be in many movies and/...
GuidoMedina's user avatar
0 votes
1 answer
171 views

Ruby on Rails - Problem with nested_attributes validation when allow_destroy: true

I have some model with accepts_nested_attributes_for class SomeModel < ApplicationRecord has_many :some_resources accepts_nested_attributes_for :some_resources, allow_destroy: true ......
infernal's user avatar
0 votes
1 answer
511 views

Rails 6: Nested Form not saving

I have been trying to get a simple test example of a nested form in Rails 6 running but so far I have not been able to create an example that works. As far as I know I created a correct association in ...
Aloalo's user avatar
  • 167
1 vote
0 answers
55 views

Rails 6 Nested Attributes, Uniquness Validation Failing on destroyed records

I am facing issue in validating nested attributes uniquness. I have 2 models #model : CompanyStore class CompanyStore < ApplicationRecord has_many :company_stores_brands, dependent: :destroy ...
Ankita Agrawal's user avatar
0 votes
0 answers
116 views

Change OBJECT ATTRIBUTE that it is ATTRIBUTE of an other OBJECT in PYTHON

I am trying to implement a structural analysis class and I getting the following error. The idea is to assign a CrossSection object to a Beam object and assign the value of Beam.eleTag attribute (...
MarcoPellegrino's user avatar
0 votes
0 answers
50 views

What the buildpack should i add for the nested attributes to make it work in heroku?

What the buildpack should i add for the link_to_add_association to make it work in heroku? for some reason the gem cocoon works locally but not working in heroku Someone mention to add buildpack to my ...
nourza's user avatar
  • 2,323
0 votes
0 answers
123 views

gem cocoon work locally but not in production

I did alot of research to make this work. but nothing solved mine link_to_add_association not working in heroku gem "cocoon" <%= form_for(resource, as: resource_name, url: ...
nourza's user avatar
  • 2,323
0 votes
1 answer
1k views

link_to_add_association and link_to_remove_association Nested form Cocoon gem

his is the first time I am using cocoon gem so I am not sure how to use it properly,I am not getting error but the link_to_add_association is not working." link_to_remove_association" gives &...
mamadgi aishwarya's user avatar
0 votes
0 answers
44 views

Saving in two tables from one form / first implementation - no insertion / second - no implicit conversion of Symbol into Integer

I want to insert into two database tables by clicking on a button. And there are several problems: First Problem: Models: class Dish < ApplicationRecord
 has_many :courses
 has_many :days, ...
ADV's user avatar
  • 97
-1 votes
1 answer
380 views

Rails 4 Accept nested attributes with has_one association

I have a question about Rails Nested Attributes. I'm using Rails 4 and have this model: model Location has_one parking_photo has_many cod_photos accepts_nested_attributes_for :parking_photo ...
Kyle's user avatar
  • 33
0 votes
2 answers
55 views

Rails 5 how to edit join model attributes from the parent model's view?

I have a system where admins can create Exams and price them according to the Branch they are selling them in. So for example, Exam One can cost $5 in Branch One, but $10 in Branch Two. I made a join ...
sbstnssndn's user avatar
-1 votes
1 answer
109 views

"ActiveModel::ForbiddenAttributesError " on Rails App ( 5) with nested attributes

I have a simple_form_for that creates an invoice. Through this form, I want the user to be able to create a client that will be associated with that before-mentionned invoice. The current process ...
Narf's user avatar
  • 33
0 votes
1 answer
100 views

Model with nested attributes doesn't show fields_for in field that is not an attribute in the model

I have an Exam and an ExamBattery that is just a collection of Exams. They have a has_and_belong_to_many declaration for each other, and ExamBattery accepts nested attributes for Exam, like so: class ...
sbstnssndn's user avatar
1 vote
3 answers
560 views

Simple form with has_many through and join table

I have models: Product, Parts and ProductParts product.rb class Product < ApplicationRecord has_many :product_parts has_many :parts, through: :product_parts accepts_nested_attributes_for :...
Lukasz's user avatar
  • 217
1 vote
0 answers
716 views

Ruby on Rail: How can I use _destroy as an attribute to destroy an object on save (NOT NESTED)?

I have an app that uses a lot of nested objects/attributes. The general paradigm is to set _destroy as an attribute for something that you want to destroy. This only works for nested attributes though,...
pixelearth's user avatar
  • 14.4k
0 votes
2 answers
1k views

How to get the right position with Sortable.js, acts_as_list and Stimulus for nested_attributes

I'm trying to implement the "Drag and Drop Sortable Lists" (https://gorails.com/episodes/rails-drag-and-drop-sortable) with nested_attributes. Unfortunately, I'm getting the wrong :position. ...
Mirha Masala's user avatar
1 vote
1 answer
25 views

Devise strong_params on Nested attributes form

I am following this tutorial [https://kakimotonline.com/2014/03/30/extending-devise-registrations-controller/][1], whose purpose is creating a Devise User, and its owning Company on the same form. ...
pierrecode's user avatar

1
2 3 4 5
33