Permalink
Browse files

post edit and destroy implemented

  • Loading branch information...
1 parent 0ba61f2 commit 61b26748aff34b3b187384500b3a32e05dec17c5 woody2shoes committed Aug 10, 2010
Showing with 289 additions and 172 deletions.
  1. +3 −3 Gemfile
  2. +132 −141 Gemfile.lock
  3. +1 −1 Rakefile
  4. +15 −0 app/controllers/posts_controller.rb
  5. +19 −0 app/views/posts/_form.html.erb
  6. +1 −19 app/views/posts/create.html.erb
  7. +1 −0 app/views/posts/edit.html.erb
  8. +1 −0 capybara-20100810000840.html
  9. +1 −0 capybara-20100810001209.html
  10. +37 −0 capybara-20100810001324.html
  11. +32 −0 capybara-20100810001503.html
  12. +2 −0 config/environments/test.rb
  13. +7 −4 config/routes.rb
  14. +31 −2 features/posts.feature
  15. +6 −2 features/step_definitions/posts.steps.rb
  16. BIN vendor/cache/actionmailer-3.0.0.rc.gem
  17. BIN vendor/cache/actionpack-3.0.0.rc.gem
  18. BIN vendor/cache/activemodel-3.0.0.rc.gem
  19. BIN vendor/cache/activerecord-3.0.0.rc.gem
  20. BIN vendor/cache/activeresource-3.0.0.rc.gem
  21. BIN vendor/cache/activesupport-3.0.0.rc.gem
  22. BIN vendor/cache/capybara-0.3.9.gem
  23. BIN vendor/cache/cucumber-0.8.5.gem
  24. BIN vendor/cache/erubis-2.6.6.gem
  25. BIN vendor/cache/gherkin-2.1.5.gem
  26. BIN vendor/cache/json_pure-1.4.6.gem
  27. BIN vendor/cache/launchy-0.3.7.gem
  28. BIN vendor/cache/nokogiri-1.4.3.1.gem
  29. BIN vendor/cache/rack-1.2.1.gem
  30. BIN vendor/cache/rack-mount-0.6.9.gem
  31. BIN vendor/cache/rails-3.0.0.rc.gem
  32. BIN vendor/cache/railties-3.0.0.rc.gem
  33. BIN vendor/cache/rspec-2.0.0.beta.19.gem
  34. BIN vendor/cache/rspec-core-2.0.0.beta.19.gem
  35. BIN vendor/cache/rspec-expectations-2.0.0.beta.19.gem
  36. BIN vendor/cache/rspec-mocks-2.0.0.beta.19.gem
  37. BIN vendor/cache/rspec-rails-2.0.0.beta.19.gem
  38. BIN vendor/cache/rubyzip-0.9.4.gem
  39. BIN vendor/cache/selenium-webdriver-0.0.27.gem
  40. BIN vendor/cache/thor-0.14.0.gem
  41. BIN vendor/cache/webrat-0.7.2.beta.1.gem
View
@@ -1,6 +1,6 @@
source 'http://rubygems.org'
-gem 'rails', '3.0.0.beta4'
+gem 'rails', '3.0.0.rc'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -12,8 +12,8 @@ gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
-gem 'rspec', '2.0.0.beta.12'
-gem 'rspec-rails', '2.0.0.beta.12'
+gem 'rspec', '2.0.0.beta.19'
+gem 'rspec-rails', '2.0.0.beta.19'
gem 'spork'
gem 'launchy'
View
@@ -1,141 +1,132 @@
----
-dependencies:
- spork:
- group:
- - :default
- version: ">= 0"
- rails:
- group:
- - :default
- version: = 3.0.0.beta4
- mysql:
- group:
- - :default
- version: ">= 0"
- rspec:
- group:
- - :default
- version: = 2.0.0.beta.12
- rspec-rails:
- group:
- - :default
- version: = 2.0.0.beta.12
- database_cleaner:
- group:
- - :default
- version: ">= 0"
- cucumber-rails:
- group:
- - :default
- version: ">= 0"
- cucumber:
- group:
- - :default
- version: ">= 0"
- launchy:
- group:
- - :default
- version: ">= 0"
- capybara:
- group:
- - :default
- version: ">= 0"
-specs:
-- rake:
- version: 0.8.7
-- abstract:
- version: 1.0.0
-- activesupport:
- version: 3.0.0.beta4
-- builder:
- version: 2.1.2
-- i18n:
- version: 0.4.1
-- activemodel:
- version: 3.0.0.beta4
-- erubis:
- version: 2.6.5
-- rack:
- version: 1.1.0
-- rack-mount:
- version: 0.6.6
-- rack-test:
- version: 0.5.4
-- tzinfo:
- version: 0.3.22
-- actionpack:
- version: 3.0.0.beta4
-- mime-types:
- version: "1.16"
-- polyglot:
- version: 0.3.1
-- treetop:
- version: 1.4.8
-- mail:
- version: 2.2.5
-- actionmailer:
- version: 3.0.0.beta4
-- arel:
- version: 0.4.0
-- activerecord:
- version: 3.0.0.beta4
-- activeresource:
- version: 3.0.0.beta4
-- bundler:
- version: 0.9.26
-- culerity:
- version: 0.2.10
-- nokogiri:
- version: 1.4.2
-- ffi:
- version: 0.6.3
-- json_pure:
- version: 1.4.3
-- selenium-webdriver:
- version: 0.0.24
-- capybara:
- version: 0.3.8
-- configuration:
- version: 1.1.0
-- diff-lcs:
- version: 1.1.2
-- trollop:
- version: 1.16.2
-- gherkin:
- version: 2.0.2
-- term-ansicolor:
- version: 1.0.5
-- cucumber:
- version: 0.8.3
-- cucumber-rails:
- version: 0.3.2
-- database_cleaner:
- version: 0.5.2
-- launchy:
- version: 0.3.5
-- mysql:
- version: 2.8.1
-- thor:
- version: 0.13.6
-- railties:
- version: 3.0.0.beta4
-- rails:
- version: 3.0.0.beta4
-- rspec-core:
- version: 2.0.0.beta.12
-- rspec-expectations:
- version: 2.0.0.beta.12
-- rspec-mocks:
- version: 2.0.0.beta.12
-- rspec:
- version: 2.0.0.beta.12
-- webrat:
- version: 0.7.1
-- rspec-rails:
- version: 2.0.0.beta.12
-- spork:
- version: 0.8.4
-hash: 9ed74a6df607361146b278be6dd4ec070c613c78
-sources:
-- Rubygems:
- uri: http://rubygems.org
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ mail (~> 2.2.5)
+ actionpack (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4.1)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.9)
+ rack-test (~> 0.5.4)
+ tzinfo (~> 0.3.22)
+ activemodel (3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ builder (~> 2.1.2)
+ i18n (~> 0.4.1)
+ activerecord (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ arel (~> 0.4.0)
+ tzinfo (~> 0.3.22)
+ activeresource (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ activesupport (3.0.0.rc)
+ arel (0.4.0)
+ activesupport (>= 3.0.0.beta)
+ builder (2.1.2)
+ capybara (0.3.9)
+ culerity (>= 0.2.4)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (>= 0.0.3)
+ configuration (1.1.0)
+ cucumber (0.8.5)
+ builder (~> 2.1.2)
+ diff-lcs (~> 1.1.2)
+ gherkin (~> 2.1.4)
+ json_pure (~> 1.4.3)
+ term-ansicolor (~> 1.0.4)
+ cucumber-rails (0.3.2)
+ cucumber (>= 0.8.0)
+ culerity (0.2.10)
+ database_cleaner (0.5.2)
+ diff-lcs (1.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ ffi (0.6.3)
+ rake (>= 0.8.7)
+ gherkin (2.1.5)
+ trollop (~> 1.16.2)
+ i18n (0.4.1)
+ json_pure (1.4.6)
+ launchy (0.3.7)
+ configuration (>= 0.0.5)
+ rake (>= 0.8.1)
+ mail (2.2.5)
+ activesupport (>= 2.3.6)
+ mime-types
+ treetop (>= 1.4.5)
+ mime-types (1.16)
+ mysql (2.8.1)
+ nokogiri (1.4.3.1)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.9)
+ rack (>= 1.0.0)
+ rack-test (0.5.4)
+ rack (>= 1.0)
+ rails (3.0.0.rc)
+ actionmailer (= 3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ activerecord (= 3.0.0.rc)
+ activeresource (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ bundler (>= 1.0.0.rc.1)
+ railties (= 3.0.0.rc)
+ railties (3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ rake (>= 0.8.3)
+ thor (~> 0.14.0)
+ rake (0.8.7)
+ rspec (2.0.0.beta.19)
+ rspec-core (= 2.0.0.beta.19)
+ rspec-expectations (= 2.0.0.beta.19)
+ rspec-mocks (= 2.0.0.beta.19)
+ rspec-core (2.0.0.beta.19)
+ rspec-expectations (2.0.0.beta.19)
+ diff-lcs (>= 1.1.2)
+ rspec-mocks (2.0.0.beta.19)
+ rspec-rails (2.0.0.beta.19)
+ rspec (= 2.0.0.beta.19)
+ webrat (>= 0.7.2.beta.1)
+ rubyzip (0.9.4)
+ selenium-webdriver (0.0.27)
+ ffi (>= 0.6.1)
+ json_pure
+ rubyzip
+ spork (0.8.4)
+ term-ansicolor (1.0.5)
+ thor (0.14.0)
+ treetop (1.4.8)
+ polyglot (>= 0.3.1)
+ trollop (1.16.2)
+ tzinfo (0.3.22)
+ webrat (0.7.2.beta.1)
+ nokogiri (>= 1.2.0)
+ rack (>= 1.0)
+ rack-test (>= 0.5.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ capybara
+ cucumber
+ cucumber-rails
+ database_cleaner
+ launchy
+ mysql
+ rails (= 3.0.0.rc)
+ rspec (= 2.0.0.beta.19)
+ rspec-rails (= 2.0.0.beta.19)
+ spork
View
@@ -7,4 +7,4 @@ require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
-Rails::Application.load_tasks
+Rpress::Application.load_tasks
@@ -17,4 +17,19 @@ def create
@post = Post.new
end
end
+
+ def edit
+ @post = Post.find_by_id(params[:id])
+ if request.post?
+ @post.update_attributes(params[:post])
+ if @post.save
+ redirect_to "/post/#{@post.id}"
+ end
+ end
+ end
+
+ def destroy
+ Post.destroy(params[:id])
+ redirect_to '/'
+ end
end
@@ -0,0 +1,19 @@
+<%= form_for @post, :url => "/posts/#{@post.new_record? ? 'create' : "edit/#{@post.id}"}", :html => {:method => :post} do |form| %>
+ <div>
+ <%= form.label :title %>
+ <%= form.text_field :title %>
+ </div>
+ <div>
+ <%= form.label :body %>
+ <%= form.text_area :body %>
+ </div>
+ <div>
+ <%= form.label :author_id %>
+ <%= form.select :author_id, User.all.map {|u| [u.name, u.id]} %>
+ </div>
+ <div>
+ <%= form.label :published_on %>
+ <%= form.text_field :published_on %>
+ </div>
+ <div><%= submit_tag "Save Post"%>
+<% end %>
@@ -1,19 +1 @@
-<%= form_for @post, :url => "/posts/create" do |form| %>
- <div>
- <%= form.label :title %>
- <%= form.text_field :title %>
- </div>
- <div>
- <%= form.label :body %>
- <%= form.text_area :body %>
- </div>
- <div>
- <%= form.label :author_id %>
- <%= form.select :author_id, User.all.map {|u| [u.name, u.id]} %>
- </div>
- <div>
- <%= form.label :published_on %>
- <%= form.text_field :published_on %>
- </div>
- <div><%= submit_tag "Save Post"%>
-<% end %>
+<%= render :partial => 'form' %>
@@ -0,0 +1 @@
+<%= render :partial => 'form' %>
@@ -0,0 +1 @@
+Not Found
@@ -0,0 +1 @@
+Not Found
Oops, something went wrong.

0 comments on commit 61b2674

Please sign in to comment.