Complete Lesson 12 Part 1
This commit is contained in:
parent
b3cb78a4d8
commit
b6237c5daa
@ -8,4 +8,7 @@ class MoviesController < ApplicationController
|
||||
def show
|
||||
@movie = Movie.find(params[:id])
|
||||
end
|
||||
def edit
|
||||
@movie = Movie.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
20
app/views/movies/edit.html.erb
Normal file
20
app/views/movies/edit.html.erb
Normal file
@ -0,0 +1,20 @@
|
||||
<h1>Editing <%= @movie.title %></h1>
|
||||
|
||||
<%= form_with(model: @movie) do |f| %>
|
||||
<%= f.label :title %>
|
||||
<%= f.text_field :title %>
|
||||
|
||||
<%= f.label :description %>
|
||||
<%= f.text_area :description, rows: 7 %>
|
||||
|
||||
<%= f.label :rating %>
|
||||
<%= f.text_field :rating %>
|
||||
|
||||
<%= f.label :released_on %>
|
||||
<%= f.date_field :released_on %>
|
||||
|
||||
<%= f.label :total_gross %>
|
||||
<%= f.number_field :total_gross %>
|
||||
|
||||
<%= f.submit %>
|
||||
<% end %>
|
@ -13,5 +13,8 @@
|
||||
<td><%= total_gross(@movie) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<section class="admin">
|
||||
<%= link_to "Edit", edit_movie_path(@movie), class: "button" %>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -2,4 +2,5 @@ Rails.application.routes.draw do
|
||||
root "movies#index"
|
||||
get "movies" => "movies#index"
|
||||
get "movies/:id" => "movies#show", as: "movie"
|
||||
get "movies/:id/edit" => "movies#edit", as: "edit_movie"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user