Guest User

Untitled

a guest
Apr 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. ## View, this works
  2.  
  3. <%= link_to 'New House', new_house_path %>
  4. <h1><%= h(@house.name) %></h1>
  5. <p><%= h(@house.street) %> @ <%= h(@house.zipcode) %></p>
  6.  
  7. <% if @residents %>
  8. <%= render :partial => 'resident', :collection => @residents, :locals => {:house => @house} %>
  9. <% end %>
  10.  
  11. <% unless @user.houses.size <= 1 %>
  12. <% form_tag selected_houses_path do %>
  13. <%= select(:house, :id, @user.houses.collect { |h| [h(h.name), h.id] }, {}, {:onchange => "this.form.submit()"}) %>
  14. <% end %>
  15. <% end %>
  16.  
  17. ## This should also work but it doesnt
  18.  
  19. <%= link_to 'New House', new_house_path %>
  20. <h1><%= h(@house.name) %></h1>
  21. <p><%= h(@house.street) %> @ <%= h(@house.zipcode) %></p>
  22.  
  23. <% if @residents %>
  24. <%= render :partial => @residents, :locals => {:house => @house} %>
  25. <% end %>
  26.  
  27. <% unless @user.houses.size <= 1 %>
  28. <% form_tag selected_houses_path do %>
  29. <%= select(:house, :id, @user.houses.collect { |h| [h(h.name), h.id] }, {}, {:onchange => "this.form.submit()"}) %>
  30. <% end %>
  31. <% end %>
  32.  
  33.  
  34. ## Here is the partial
  35.  
  36. <p>
  37. <%= h(resident[:name]) %>
  38. <% if @house.unapproved_residents.include? resident[:user] and resident[:user] != @user %>
  39. (approve this user)
  40. <% elsif @house.unapproved_residents.include? resident[:user] %>
  41. (awaiting approval)
  42. <% end %>
  43. </p>
Add Comment
Please, Sign In to add comment