Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. def loan_application_params
  2. params.require(:loan_application).permit(:loan_application_id, :business_id, :status, loan_securities_attributes: [:id, :loan_application_id, :security_type, :book_value, :implied_value, :loan_salesforce_id, :type_of_valuation, :other_type_of_valuation, :_destroy])
  3. end
  4.  
  5. # Loan Application Model
  6. class LoanApplication < ActiveRecord::Base
  7. has_many :loan_securities, :dependent => :destroy
  8. accepts_nested_attributes_for :loan_securities, :allow_destroy => true
  9.  
  10. # Loan Security Model
  11. class LoanSecurity < ActiveRecord::Base
  12. belongs_to :loan_application
  13.  
  14. <%= nested_form_for [@business, @loanapplication], method: :put, :class => "form-horizontal", url: wizard_path, :html => { :multipart => true } do |f| %>
  15. <%= f.fields_for :loan_securities, :wrapper => false do |loan_security| %>
  16. <%= loan_security.text_field :security_type %>
  17. <%= loan_security.text_field :book_value %>
  18. <%= loan_security.text_field :implied_value %>
  19. <%= loan_security.text_field :type_of_valuation %>
  20. <%= loan_security.link_to_remove "Delete" %>
  21. <% end %>
  22. <%= f.link_to_add "Add a Security", :loan_securities %>
  23. <% end %>
  24.  
  25. # The html of the remove button
  26. <a class="remove_nested_fields" data-association="loan_securities" href="javascript:void(0)">Delete</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement