How do i make it so users who are filling out their form when adding new prices can select categories they already made or create a new one.
I have an Add_Prices controller,model and views. The Model holds the price name, date and price as of now.
-
I don’t know if the category should be a string or integer.
-
I also don’t know how to make the form so the user can select a scroll down list on the form of past categories they saved or in the scroll down list they select “New” and a text box pops up next to it and they can save it when they fill out everything.
-
Everything(price,date,etc) including the category will go to the Data Controller/View so they can see everything there.
Please help a newbie!
Thank you!
Well, you would ideally name your controller (Link just so you can see naming conventions) the name of your resource so consider using just Price instead of Add_Prices. And as for adding categories, consider adding another resource for categories and use rails associations to associate the categories to other objects. Using this type of relationship is demonstrated over in this question here.
The category should have a name that is text and it should also have an ID generated by default.
Good luck, If you still need help feel free to let me know.