Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. has_one :scope
  2. accepts_nested_attributes_for :scope
  3.  
  4. belongs_to :project
  5. has_one :participant
  6. accepts_nested_attributes_for :participant,
  7.  
  8. belongs_to :scope
  9. has_one :address
  10. accepts_nested_attributes_for :address
  11.  
  12. belongs_to :participant
  13.  
  14. <%= f.simple_fields_for :participant do |partadd_p| %>
  15. <%= partadd_p.simple_fields_for :address do |partadd| %>
  16.  
  17.  
  18.  
  19. <div class="row">
  20. <div class="col-md-3 col-md-offset-1">
  21. <%= partadd.label 'Select participation location', :class => 'question-project' %>
  22. </div>
  23. <div class="col-md-7">
  24. <div class="response-project">
  25.  
  26. <%= partadd.input :participant_country, priority: ["AU", "NZ", "GB", "US"], label: false %>
  27.  
  28. <%= render 'addresses/partform', f: f %>
  29.  
  30. <div id="participationrequest" style="display:none">
  31. <%= render 'participants/form', f: f %>
  32. </div>
  33.  
  34. <% if @project.scope.try(:if_participant) == true %>
  35. <%= render 'participants/particulars'%>
  36. <% end %>
  37.  
  38. <% if @project.scope.participant.location_specific == true %>
  39. <%= @project.scope.participant.address.participation_country %>
  40. <% else %>
  41. <%= render :text => "Remote participation" %>
  42. <% end %>
  43.  
  44. undefined method `participation_country' for nil:NilClass
  45.  
  46. <%= @project.scope.try(:participant).try(:address).try(:participation_country) %>
  47.  
  48. def new
  49. @participant = Participant.new
  50. @participant.address = Address.new
  51.  
  52. end
  53.  
  54. @project.scope.participant = Participant.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement