I am trying to create a simple offers app. Which has companies, categories, offers and vouchers models.
I have managed to make the create offer view accept attributes from companies and categories in select boxes.
What i want to do now is in the offer create view, i want to be able to add a voucher code, voucher is its own model and it belongs_to offers, where as offers has_one voucher.
How can i create a voucher in the offers view, do i need to create a method in the offers controller? If so how can i do this?
I want the offer_id and voucher_id to be the same, so offer 1 will have a voucher 1 associated with it.
Hope i have made sense here.
If my approach here is totally wrong, please let me know i'm pretty new to rails.
Thanks in advance.