0

I want to create a nested form in Ruby on Rails. Let's say I have a Model Player and a Model Achievement.

In a form for the User I want to assign n Achievements to the User. The Achievements have been created before, so they exist when the Achievements get assigned. How do I do that? How should the View, the Controller and the Models look like? I searched for hours but I didn't find anything.

I'd like to realize it with a select field, with which the Achievements get selected.

1 Answer 1

1

there is quite a few examples out there and depending which form are you using you can choose:

you can also use simple_forms https://github.com/heartcombo/simple_form which will automatically create a select field for the achievements (you can check their documentation) and this might help How should I use rails and simple_form for nested resources?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.