Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. # Loan Application Model
  2. class LoanApplication < ActiveRecord::Base
  3. has_many :loan_securities, :dependent => :destroy
  4. accepts_nested_attributes_for :loan_securities, :allow_destroy => true
  5. end
  6.  
  7. # Loan Security Model
  8. class LoanSecurity < ActiveRecord::Base
  9. has_one :security_type
  10. accepts_nested_attributes_for :security_type
  11. end
  12.  
  13. # Security Type Model
  14. class SecurityType < ActiveRecord::Base
  15. belongs_to :loan_security
  16. end
  17.  
  18. <%= nested_form_for [@business, @loanapplication], method: :put, :class => "form-horizontal", url: wizard_path, :html => { :multipart => true } do |f| %>
  19. <%= f.fields_for :loan_securities, :wrapper => true do |loan_security| %>
  20. <%= loan_security.collection_select(:security_type_id, SecurityType.all, :id, :name) %>
  21. <% end %>
  22. <% end %>
  23.  
  24. loan_securities_attributes: [:id, :_destroy, security_type_attributes: [:security_type_id, :name]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement