This is pretty weird, I must just be missing something because I've done this a million times, and this is the first time I am seeing this.
Vanilla create controller action:
def create
@album = Album.new(album_params)
respond_to do |format|
if @album.save
format.html { redirect_to @album, notice: 'Album was successfully created.' }
format.json { render :show, status: :created, location: @album }
else
format.html { render :new }
format.json { render json: @album.errors, status: :unprocessable_entity }
end
end
end
def album_params
params.require(:album).permit(:title)
end
And a vanilla view after a successful create of an Album:
<p id="notice"><%= notice %></p>
<p>
<strong>Title:</strong>
<%= @album.title %>
</p>
<%= link_to 'Edit', edit_album_path(@album) %> |
<%= link_to 'Back', albums_path %>
I checked through debugging that after I create the album, @album is correctly set up. I also set a second instance variable @foo = 100. But in any event when the view gets rendered, both instance variables are nil, and I get this error (see image, it was the easiest way)
