Commit a4b94ef
Changed files (2)
app
controllers
views
cakes
app/controllers/cakes_controller.rb
@@ -20,9 +20,9 @@ class CakesController < ApplicationController
def create
@cake = Cake.new(params[:cake])
if @cake.save
- redirect_to @cake, notice: 'Cake was successfully created.'
+ redirect_to @cake, notice: 'Cake was successfully created.'
else
- render action: "new"
+ render action: "new"
end
end
app/views/cakes/index.html.erb
@@ -8,6 +8,7 @@
<div class="caption">
<h3><a href="<%= url_for cake %>"><%= cake.name %></a></h3>
<p><a class="btn" href="<%= url_for cake %>">View</a></p>
+ <p><%= cake.category.name rescue 'N/A' %></p>
</div>
</div>
</div>