ruby on rails - Unknown column 'photos.gallery_id' after doing db:reset -


after pulled rake db:migrate:reset, code stop working. when trying view galleries index page get: mysql2::error: unknown column 'photos.gallery_id' in 'where clause': select count(*) photos photos.gallery_id = 1

if remove 1 line of coding index.html work: <%= gallery.photos.size %>

i have not modified code. happen once did reset. curious how fix it.

index.html:

<% gallery in @galleries %>     <div class="gallery">         <h2><%= link_to gallery.name, gallery %></h2>         photos: <%= gallery.photos.size %>     </div> <% end %>  <p><%= link_to "new gallery", new_gallery_path %></p> 

the proper column "gallery_id" not sure why trying pull "photos.gallery_id".

like error says, there's no column 'gallery_id' in 'photos' table. try inspect database , check if exists. try:

rails c > photo 

and see if there's field called 'gallery_id'.

you should try running rake db:migrate.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -