Questions tagged [accepts-nested-attributes]

71 questions
0
votes
1 answer

How to pass params to nested attributes in fields_for form in rails 5 with paperclip

A property has multiple pictures. The images uploaded in the form should be accessible through the Property class. //Picture Model class Picture < ApplicationRecord belongs_to :property has_attached_file :image, styles: { medium: "300x300>",…
0
votes
1 answer

Unpermitted parameter in Rails API nested attributes

I'm trying to update an object using nested fields and am receiving an Unpermitted parameters error. The field that is causing the error is in itself a relation to another table within the nested table. Below are the specifics: Doctor class class…
0
votes
1 answer

Ruby on Rails 5: double association between two models

I've been working on this issue for a few days now, and the other Stack Overflow posts I've looked at are either really old, or not quite what I need. Problem: There are three models involved: Trip - represents a trip and its associated information,…
0
votes
1 answer

Rails 5 - Strong Parameters for Nested Attributes

I am having trouble structuring my nested attributes for my model Request. The data is being passed in the correct way from my POST action. What am I missing to whitelist these parameters? Appreciate any help. Console Output Started POST "/requests"…
0
votes
1 answer

Show Page Not Working For Accepts_Nested_Attributes_For

Trying learn accepts_nested_attributes_for in basic has_many and belongs_to association. Problem is that it's not working in the show page ... The error I get is: NoMethodError in Authors#show undefined method `each' for nil:NilClass in…
user273072545345
  • 1,536
  • 2
  • 27
  • 57
0
votes
1 answer

Rails - Unpermitted nested children parameters

The parent is saved but the children isn't. If I add landslide.sources.create, it does create a row in sources table with the correct landslide_id but all the other columns are null. Here's the files: landslide_controller.rb def new @landslide…
Tri Nguyen
  • 1,688
  • 3
  • 18
  • 46
0
votes
1 answer

Rails 5 accepts_nested_attributes_for Getting Unprocessable Entity with JSON POST

I think I have all of this setup right for being able to send nested attributes, however, I keep getting 422 unprocessable entity but no error message. Here is how I have things configured: scouting_report.rb class ScoutingReport <…
Matt Long
  • 24,438
  • 4
  • 73
  • 99
0
votes
1 answer

Rails 5: fields_for nested_attributes does not save (fails at create controller)

I am trying to work in my first implementation using fields_for to manage creating has_many relationship in one form partial. This form partial itself is part of a nested resource So far, I am able to render, save and edit the form successfully…
0
votes
2 answers

Rails5, nested form, undefined param

Huston, we have a problem: class FirstModel has_many :merged_models has_many :second_models, :through => :merged_models end class SecondModel has_many :merged_models has_many :first_models, :through => :merged_models end class MergedModel …
-1
votes
1 answer

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 accepts_nested_attributes_for :cod_photos end When I…
-1
votes
1 answer

param is missing or the value is empty: task. How can I make possible to add a "To Do" while also rendering the view to create a project?

I want that when the user creates a project s/he could also add new tasks into it. I have figured out this "solution" and I have encountred this error that I can't solve. I dont even know of it is "ruby correct" that I mix tasks actions with the…
1 2 3 4
5