diff options
Diffstat (limited to 'guides/code/getting_started')
4 files changed, 23 insertions, 23 deletions
diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb index b35ea2f237..f22139938c 100644 --- a/guides/code/getting_started/app/views/posts/_form.html.erb +++ b/guides/code/getting_started/app/views/posts/_form.html.erb @@ -10,12 +10,12 @@ </div> <% end %> <p> - <%= f.label :title %><br> + <%= f.label :title %><br /> <%= f.text_field :title %> </p> <p> - <%= f.label :text %><br> + <%= f.label :text %><br /> <%= f.text_area :text %> </p> diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb index aea28cd5a2..0580879c1a 100644 --- a/guides/code/getting_started/app/views/posts/show.html.erb +++ b/guides/code/getting_started/app/views/posts/show.html.erb @@ -8,5 +8,21 @@ <%= @post.text %> </p> -<%= link_to 'Back', :action => :index %> -| <%= link_to 'Edit', :action => :edit, :id => @post.id %> + +<h2>Add a comment:</h2> +<%= form_for([@post, @post.comments.build]) do |f| %> + <p> + <%= f.label :commenter %><br /> + <%= f.text_field :commenter %> + </p> + <p> + <%= f.label :body %><br /> + <%= f.text_area :body %> + </p> + <p> + <%= f.submit %> + </p> +<% end %> + +<%= link_to 'Edit Post', edit_post_path(@post) %> | +<%= link_to 'Back to Posts', posts_path %> diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb index 6095a05a58..04a6bd374e 100644 --- a/guides/code/getting_started/config/routes.rb +++ b/guides/code/getting_started/config/routes.rb @@ -1,15 +1,8 @@ Blog::Application.routes.draw do - # resources :posts do - # resources :comments - # end - get "posts" => "posts#index" - get "posts/new" - post "posts/create" - get "posts/:id" => "posts#show", :as => :post - get "posts/:id/edit" => "posts#edit" - put "posts/:id" => "posts#update" - delete "posts/:id" => "posts#destroy" + resources :posts do + resources :comments + end # The priority is based upon order of creation: # first created -> highest priority. diff --git a/guides/code/getting_started/test/fixtures/tags.yml b/guides/code/getting_started/test/fixtures/tags.yml deleted file mode 100644 index 8485668908..0000000000 --- a/guides/code/getting_started/test/fixtures/tags.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html - -one: - name: MyString - post: - -two: - name: MyString - post: |