196-nested-model-form-revised | Requires Ruby 1
kandi X-RAY | 196-nested-model-form-revised Summary
kandi X-RAY | 196-nested-model-form-revised Summary
Requires Ruby 1.9.2 or higher.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of 196-nested-model-form-revised
196-nested-model-form-revised Key Features
196-nested-model-form-revised Examples and Code Snippets
Community Discussions
Trending Discussions on 196-nested-model-form-revised
QUESTION
I'm running Rails 6.0.0.rc1 and having trouble getting a triple nested form working. I have products
that have options
that have option_values
. So a Product might have an option called "Color" and an Option Value named "Red." I'd like to create all of these in a classic nested form in the Product form.
The form works and I can save Product with an Option, but not the Option Value on submit. I'm not sure why it's not working when I try to embed fields_for
Option Values inside the fields_for
Options.
What am I doing wrong here? I feel like I'm missing something obvious, but can't figure it out. (Probably not relevant, but note that I need to scope each object to account_id
and my User has_one :account
that's the reason for the hidden field.)
Here is my product model:
...ANSWER
Answered 2019-May-31 at 04:17At first, you need to change the form to nest option_values
inside option
, and add account_id
field to option values:
QUESTION
I'm trying to create a 'blog' example with a circular and dynamic nested form, but I can't make it work, it just keeps loading forever and I need to kill the server in order to stop it.
A blog has comments, and a comment has comments. That's all.
Please help me :)
I'm using:
- rails (5.1.6)
- activerecord (5.1.6)
- simple_form (3.5.1)
- cocoon (1.2.11)
- jquery-rails (4.3.1)
- haml (5.0.4)
blog.rb
...ANSWER
Answered 2018-Apr-09 at 11:31Well... it's an issue with the cocoon gem. I found a possible (and dirty) solution, if I limit the nesting, it works.
QUESTION
I have been following both the old and revised railscasts & this for something that i have to make along the same lines
I followed it upto some point but neither are the questions being displayed on the form nor are the answers getting added . Following is my model code
answers.rb
...ANSWER
Answered 2017-Jul-08 at 09:51The main issue here is it looks like you forgot an 'answer' migration to create the tables, create that and run it and should fix things up.
Additionally, those attr_accessor
calls are going to be messing things up. They were required in older versions of Rails, but aren't anymore and now just serve throw things off. Example
With attr_accessor
code
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install 196-nested-model-form-revised
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page