Guest User

Untitled

a guest
May 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. ## The setup
  2. *bonus has_one photo, photo belongs_to bonus
  3. *i've confirmed @bonus is not nil at this point
  4. ## The question
  5. why does it say 'nil_class' instead of 'bonus' or 'photo' or something nice?
  6. ## The View
  7. <% form_for(@bonus, :html => { :multipart => true }) do |f| %>
  8. <% fields_for @bonus.photo do |photo_field| %>
  9. image file: <%= photo_field.file_field :uploaded_data %>
  10. <% end %>
  11. ...other regular bonus fields...
  12. <%= f.submit "Update" %>
  13. <% end %>
  14. ## The Resulting HTML
  15. <h2>Upload a new photo</h2>
  16. image file: <input id="nil_class_uploaded_data" name="nil_class[uploaded_data]" size="30" type="file" />
  17. ## The clean pastie knowledge-gain acknowledgment
  18. um, thanks leeth, yer the shit
Add Comment
Please, Sign In to add comment