Skip to content

Commit

Permalink
made consistent with Rails tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
armandofox committed Dec 11, 2011
1 parent 1d456d0 commit 9e45c5b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
23 changes: 23 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,26 @@
*= require_self
*= require_tree .
*/

html {
font-family: Verdana,Helvetica,sans-serif;
color: navy;
}

body {
background-color: silver;
}

h1, h2 {
background-color: #ddd;
margin: 0;
}
form {
padding: 1em;
border-style: inset;
}
form label {
display: block;
color: #333;
font-style: italic;
}
18 changes: 10 additions & 8 deletions app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ def show
# will render app/views/movies/show.<extension> by default
end

# in movies_controller.rb
def create
Movie.create!(params[:movie])
redirect_to movies_path
end
def index
@movies = Movie.all
end

def new
# default: render 'new' template
end

def create
@movie = Movie.new(params[:movie])
@movie.save!
flash[:notice] = "#{@movie.title} was successfully created."
redirect_to movies_path
end
# in movies_controller.rb

def edit
@movie = Movie.find params[:id]
Expand All @@ -25,9 +28,8 @@ def edit
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



end
18 changes: 0 additions & 18 deletions app/views/movies/_edit_form.html.haml

This file was deleted.

2 changes: 2 additions & 0 deletions app/views/movies/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
%td= movie.rating
%td= movie.release_date
%td= link_to "More about #{movie.title}", movie

= link_to 'Add new movie', new_movie_path

0 comments on commit 9e45c5b

Please sign in to comment.