Guest User

Untitled

a guest
May 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. NoMethodError in Photos#create
  2.  
  3. Showing app/views/photos/new.html.erb where line #22 raised:
  4.  
  5. You have a nil object when you didn't expect it!
  6. You might have expected an instance of Array.
  7. The error occurred while evaluating nil.empty?
  8.  
  9. Extracted source (around line #22):
  10.  
  11. 19: <% route = @thing.nil? ? @photo : [@thing, @photo] %>
  12. 20: <% form_for route, :html => { :multipart => true } do |f| %>
  13. 21: <div class="text"><%= f.label "photo", t(:"choose_file") %><%= f.file_field :file %></div>
  14. 22: <% if @thing.class != Gallery && !@galleries.empty? %>
  15. 23: <div class="text"><%= f.label "gallery_id" %><%= f.select "gallery_id", @galleries.map { |g| [g.title, g.id] }, :include_blank => true %>
  16. 24: <% end %>
  17. 25: <div class="button"><%= submit_tag t(:"upload") %> <%= t :"or" %> <%= link_to t(:"cancel"), :id => "cancel" %></div>
  18.  
  19. RAILS_ROOT: /biz/bangsr
  20.  
  21. app/views/photos/new.html.erb:22
  22. app/views/photos/new.html.erb:20
  23. app/controllers/photos_controller.rb:41:in `create'
Add Comment
Please, Sign In to add comment