Hello I am following a rails tutorial, I am using rails 3.2.3 and I have this error Routing Error
No route matches [POST] "/movies/9/edit"
Here is my haml page:
%h2 Edit Movie
= form_tag edit_movie_path(@movie), :method => :put do
= label :movie, :title, 'Title' = text_field :movie, 'title'
= label :movie, :rating, 'Rating' = select :movie, :rating, ['G','PG','PG-13','R','NC-17']
= label :movie, :release_date, 'Released On' = date_select :movie, :release_date
= submit_tag 'Save Changes'
Here is my controller:
def edit
@movie = Movie.find params[:id]
end
def update
@movie = Movie.find params[:id]
@movie.update_attributes!(params[:movie])
flash[:notice] = "#{@movie.title} was successfully updated."
redirect_to movie_path(@movie)
end
and my routes:
movies GET /movies(.:format) movies#index
POST /movies(.:format) movies#create
new_movie GET /movies/new(.:format) movies#new edit_movie GET /movies/:id/edit(.:format) movies#edit
movie GET /movies/:id(.:format) movies#show
PUT /movies/:id(.:format) movies#update
DELETE /movies/:id(.:format) movies#destroy
Thanks for the help