Jump to content

The ultimate community for Ruby on Rails developers.


Working with multiple models in one view.


  • Please log in to reply
No replies to this topic

#1 Paul Allen

Paul Allen


  • Members
  • 1 posts

Posted 14 October 2013 - 09:49 AM

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.

Also tagged with one or more of these keywords: models

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users