carlosbrando-remarkable 0.0.99

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +124 -0
  3. data/PostInstall.txt +7 -0
  4. data/README.rdoc +48 -0
  5. data/Rakefile +29 -0
  6. data/init.rb +1 -0
  7. data/lib/remarkable.rb +13 -0
  8. data/lib/remarkable/active_record/active_record.rb +21 -0
  9. data/lib/remarkable/active_record/helpers.rb +16 -0
  10. data/lib/remarkable/active_record/macros/associations/belong_to.rb +81 -0
  11. data/lib/remarkable/active_record/macros/associations/have_and_belong_to_many.rb +77 -0
  12. data/lib/remarkable/active_record/macros/associations/have_many.rb +160 -0
  13. data/lib/remarkable/active_record/macros/associations/have_one.rb +133 -0
  14. data/lib/remarkable/active_record/macros/database/have_db_column.rb +81 -0
  15. data/lib/remarkable/active_record/macros/database/have_db_columns.rb +73 -0
  16. data/lib/remarkable/active_record/macros/database/have_indices.rb +75 -0
  17. data/lib/remarkable/active_record/macros/validations/allow_values_for.rb +103 -0
  18. data/lib/remarkable/active_record/macros/validations/ensure_length_at_least.rb +97 -0
  19. data/lib/remarkable/active_record/macros/validations/ensure_length_in_range.rb +134 -0
  20. data/lib/remarkable/active_record/macros/validations/ensure_length_is.rb +106 -0
  21. data/lib/remarkable/active_record/macros/validations/ensure_value_in_range.rb +117 -0
  22. data/lib/remarkable/active_record/macros/validations/have_class_methods.rb +74 -0
  23. data/lib/remarkable/active_record/macros/validations/have_instance_methods.rb +74 -0
  24. data/lib/remarkable/active_record/macros/validations/have_named_scope.rb +148 -0
  25. data/lib/remarkable/active_record/macros/validations/have_readonly_attributes.rb +81 -0
  26. data/lib/remarkable/active_record/macros/validations/only_allow_numeric_values_for.rb +89 -0
  27. data/lib/remarkable/active_record/macros/validations/protect_attributes.rb +89 -0
  28. data/lib/remarkable/active_record/macros/validations/require_acceptance_of.rb +94 -0
  29. data/lib/remarkable/active_record/macros/validations/require_attributes.rb +94 -0
  30. data/lib/remarkable/active_record/macros/validations/require_unique_attributes.rb +146 -0
  31. data/lib/remarkable/controller/controller.rb +15 -0
  32. data/lib/remarkable/controller/helpers.rb +48 -0
  33. data/lib/remarkable/controller/macros/assign_to.rb +110 -0
  34. data/lib/remarkable/controller/macros/filter_params.rb +52 -0
  35. data/lib/remarkable/controller/macros/redirect_to.rb +24 -0
  36. data/lib/remarkable/controller/macros/render_a_form.rb +23 -0
  37. data/lib/remarkable/controller/macros/render_template.rb +18 -0
  38. data/lib/remarkable/controller/macros/render_with_layout.rb +61 -0
  39. data/lib/remarkable/controller/macros/respond_with.rb +86 -0
  40. data/lib/remarkable/controller/macros/respond_with_content_type.rb +45 -0
  41. data/lib/remarkable/controller/macros/return_from_session.rb +45 -0
  42. data/lib/remarkable/controller/macros/route.rb +91 -0
  43. data/lib/remarkable/controller/macros/set_the_flash_to.rb +58 -0
  44. data/lib/remarkable/example/example_methods.rb +32 -0
  45. data/lib/remarkable/private_helpers.rb +123 -0
  46. data/rails/init.rb +1 -0
  47. data/script/console +10 -0
  48. data/script/destroy +14 -0
  49. data/script/generate +14 -0
  50. data/spec/controllers/posts_controller_spec.rb +166 -0
  51. data/spec/controllers/users_controller_spec.rb +14 -0
  52. data/spec/fixtures/addresses.yml +3 -0
  53. data/spec/fixtures/friendships.yml +0 -0
  54. data/spec/fixtures/posts.yml +5 -0
  55. data/spec/fixtures/products.yml +0 -0
  56. data/spec/fixtures/taggings.yml +0 -0
  57. data/spec/fixtures/tags.yml +9 -0
  58. data/spec/fixtures/users.yml +6 -0
  59. data/spec/models/address_spec.rb +21 -0
  60. data/spec/models/dog_spec.rb +17 -0
  61. data/spec/models/flea_spec.rb +9 -0
  62. data/spec/models/friendship_spec.rb +13 -0
  63. data/spec/models/post_spec.rb +35 -0
  64. data/spec/models/product_spec.rb +57 -0
  65. data/spec/models/tag_spec.rb +21 -0
  66. data/spec/models/tagging_spec.rb +13 -0
  67. data/spec/models/user_spec.rb +107 -0
  68. data/spec/rails_root/app/controllers/application.rb +25 -0
  69. data/spec/rails_root/app/controllers/posts_controller.rb +85 -0
  70. data/spec/rails_root/app/controllers/users_controller.rb +84 -0
  71. data/spec/rails_root/app/helpers/application_helper.rb +3 -0
  72. data/spec/rails_root/app/helpers/posts_helper.rb +2 -0
  73. data/spec/rails_root/app/helpers/users_helper.rb +2 -0
  74. data/spec/rails_root/app/models/address.rb +7 -0
  75. data/spec/rails_root/app/models/dog.rb +5 -0
  76. data/spec/rails_root/app/models/flea.rb +3 -0
  77. data/spec/rails_root/app/models/friendship.rb +4 -0
  78. data/spec/rails_root/app/models/post.rb +12 -0
  79. data/spec/rails_root/app/models/product.rb +12 -0
  80. data/spec/rails_root/app/models/tag.rb +8 -0
  81. data/spec/rails_root/app/models/tagging.rb +4 -0
  82. data/spec/rails_root/app/models/user.rb +28 -0
  83. data/spec/rails_root/app/views/layouts/posts.rhtml +17 -0
  84. data/spec/rails_root/app/views/layouts/users.rhtml +17 -0
  85. data/spec/rails_root/app/views/layouts/wide.html.erb +1 -0
  86. data/spec/rails_root/app/views/posts/edit.rhtml +27 -0
  87. data/spec/rails_root/app/views/posts/index.rhtml +25 -0
  88. data/spec/rails_root/app/views/posts/new.rhtml +26 -0
  89. data/spec/rails_root/app/views/posts/show.rhtml +18 -0
  90. data/spec/rails_root/app/views/users/edit.rhtml +22 -0
  91. data/spec/rails_root/app/views/users/index.rhtml +22 -0
  92. data/spec/rails_root/app/views/users/new.rhtml +21 -0
  93. data/spec/rails_root/app/views/users/show.rhtml +13 -0
  94. data/spec/rails_root/config/boot.rb +109 -0
  95. data/spec/rails_root/config/database.yml +4 -0
  96. data/spec/rails_root/config/environment.rb +14 -0
  97. data/spec/rails_root/config/environments/sqlite3.rb +0 -0
  98. data/spec/rails_root/config/initializers/new_rails_defaults.rb +15 -0
  99. data/spec/rails_root/config/initializers/shoulda.rb +8 -0
  100. data/spec/rails_root/config/routes.rb +6 -0
  101. data/spec/rails_root/db/migrate/001_create_users.rb +18 -0
  102. data/spec/rails_root/db/migrate/002_create_posts.rb +13 -0
  103. data/spec/rails_root/db/migrate/003_create_taggings.rb +12 -0
  104. data/spec/rails_root/db/migrate/004_create_tags.rb +11 -0
  105. data/spec/rails_root/db/migrate/005_create_dogs.rb +12 -0
  106. data/spec/rails_root/db/migrate/006_create_addresses.rb +14 -0
  107. data/spec/rails_root/db/migrate/007_create_fleas.rb +11 -0
  108. data/spec/rails_root/db/migrate/008_create_dogs_fleas.rb +12 -0
  109. data/spec/rails_root/db/migrate/009_create_products.rb +17 -0
  110. data/spec/rails_root/db/migrate/010_create_friendships.rb +14 -0
  111. data/spec/rails_root/db/schema.rb +0 -0
  112. data/spec/rails_root/log/.keep +0 -0
  113. data/spec/rails_root/public/.htaccess +40 -0
  114. data/spec/rails_root/public/404.html +30 -0
  115. data/spec/rails_root/public/422.html +30 -0
  116. data/spec/rails_root/public/500.html +30 -0
  117. data/spec/rails_root/script/console +3 -0
  118. data/spec/rails_root/script/generate +3 -0
  119. data/spec/rails_root/vendor/plugins/.keep +0 -0
  120. data/spec/rcov.opts +2 -0
  121. data/spec/spec.opts +4 -0
  122. data/spec/spec_helper.rb +58 -0
  123. data/tasks/rspec.rake +21 -0
  124. metadata +216 -0
@@ -0,0 +1,14 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe UsersController do
4
+ fixtures :all
5
+
6
+ should_filter_params :ssn
7
+ end
8
+
9
+ describe UsersController do
10
+ fixtures :all
11
+
12
+ it { should filter_params(:ssn) }
13
+ it { should_not filter_params(:email) }
14
+ end
@@ -0,0 +1,3 @@
1
+ first:
2
+ title: Home
3
+ addressable: first (User)
File without changes
@@ -0,0 +1,5 @@
1
+ first:
2
+ id: 1
3
+ title: My Cute Kitten!
4
+ body: This is totally a cute kitten
5
+ user_id: 1
File without changes
File without changes
@@ -0,0 +1,9 @@
1
+ first:
2
+ id: 1
3
+ name: Stuff
4
+ second:
5
+ id: 2
6
+ name: Rails
7
+ third:
8
+ id: 3
9
+ name: Nothing
@@ -0,0 +1,6 @@
1
+ first:
2
+ id: 1
3
+ name: Some dude
4
+ age: 2
5
+ email: none@none.com
6
+ ssn: 123456789
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Address do
4
+ fixtures :all
5
+
6
+ it { should belong_to(:addressable) }
7
+
8
+ it { should require_unique_attributes(:title, :scoped_to => [:addressable_id, :addressable_type]) }
9
+ it { should ensure_length_at_least(:zip, 5) }
10
+ it { should only_allow_numeric_values_for(:zip) }
11
+ end
12
+
13
+ describe Address do
14
+ fixtures :all
15
+
16
+ should_belong_to :addressable
17
+
18
+ should_require_unique_attributes :title, :scoped_to => [:addressable_id, :addressable_type]
19
+ should_ensure_length_at_least :zip, 5
20
+ should_only_allow_numeric_values_for :zip
21
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Dog do
4
+ it { should belong_to(:user) }
5
+ it { should belong_to(:address) }
6
+ it { should belong_to(:user, :address) }
7
+
8
+ it { should have_and_belong_to_many(:fleas) }
9
+ end
10
+
11
+ describe Dog do
12
+ should_belong_to :user
13
+ should_belong_to :address
14
+ should_belong_to :user, :address
15
+
16
+ should_have_and_belong_to_many :fleas
17
+ end
@@ -0,0 +1,9 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Flea do
4
+ it { should have_and_belong_to_many(:dogs) }
5
+ end
6
+
7
+ describe Flea do
8
+ should_have_and_belong_to_many :dogs
9
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Friendship do
4
+ it { should belong_to(:user) }
5
+ it { should belong_to(:friend) }
6
+ it { should belong_to(:user, :friend) }
7
+ end
8
+
9
+ describe Friendship do
10
+ should_belong_to :user
11
+ should_belong_to :friend
12
+ should_belong_to :user, :friend
13
+ end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Post do
4
+ fixtures :all
5
+
6
+ it { should belong_to(:user) }
7
+ it { should belong_to(:owner) }
8
+ it { should belong_to(:user, :owner) }
9
+
10
+ it { should have_many(:tags, :through => :taggings) }
11
+ it { should have_many(:through_tags, :through => :taggings) }
12
+ it { should have_many(:tags, :through_tags, :through => :taggings) }
13
+
14
+ it { should require_unique_attributes(:title) }
15
+ it { should require_attributes(:body, :message => /wtf/) }
16
+ it { should require_attributes(:title) }
17
+ it { should only_allow_numeric_values_for(:user_id) }
18
+ end
19
+
20
+ describe Post do
21
+ fixtures :all
22
+
23
+ should_belong_to :user
24
+ should_belong_to :owner
25
+ should_belong_to :user, :owner
26
+
27
+ should_have_many :tags, :through => :taggings
28
+ should_have_many :through_tags, :through => :taggings
29
+ should_have_many :tags, :through_tags, :through => :taggings
30
+
31
+ should_require_unique_attributes :title
32
+ should_require_attributes :body, :message => /wtf/
33
+ should_require_attributes :title
34
+ should_only_allow_numeric_values_for :user_id
35
+ end
@@ -0,0 +1,57 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Product do
4
+ describe "An intangible product" do
5
+ before(:all) do
6
+ @product = Product.new(:tangible => false)
7
+ end
8
+
9
+ it { @product.should_not allow_values_for(:size, "22") }
10
+ it { @product.should allow_values_for(:size, "22kb") }
11
+
12
+ it { @product.should require_attributes(:title) }
13
+ it { @product.should ensure_value_in_range(:price, 0..99) }
14
+ end
15
+
16
+ describe "A tangible product" do
17
+ before(:all) do
18
+ @product = Product.new(:tangible => true)
19
+ end
20
+
21
+ it { @product.should_not allow_values_for(:size, "22", "10x15") }
22
+ it { @product.should allow_values_for(:size, "12x12x1") }
23
+
24
+ it { @product.should require_attributes(:price) }
25
+ it { @product.should ensure_value_in_range(:price, 1..9999) }
26
+ it { @product.should ensure_value_in_range(:weight, 1..100) }
27
+ it { @product.should ensure_length_in_range(:size, 5..20) }
28
+ end
29
+ end
30
+
31
+ describe Product do
32
+ describe "An intangible product" do
33
+ before(:all) do
34
+ @product = Product.new(:tangible => false)
35
+ end
36
+
37
+ should_not_allow_values_for :size, "22"
38
+ should_allow_values_for :size, "22kb"
39
+
40
+ should_require_attributes :title
41
+ should_ensure_value_in_range :price, 0..99
42
+ end
43
+
44
+ describe "A tangible product" do
45
+ before(:all) do
46
+ @product = Product.new(:tangible => true)
47
+ end
48
+
49
+ should_not_allow_values_for :size, "22", "10x15"
50
+ should_allow_values_for :size, "12x12x1"
51
+
52
+ should_require_attributes :price
53
+ should_ensure_value_in_range :price, 1..9999
54
+ should_ensure_value_in_range :weight, 1..100
55
+ should_ensure_length_in_range :size, 5..20
56
+ end
57
+ end
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Tag do
4
+ it { should have_many(:taggings, :dependent => :destroy) }
5
+ it { should have_many(:posts) }
6
+
7
+ it { should ensure_length_at_least(:name, 2) }
8
+
9
+ it { should protect_attributes(:secret) }
10
+
11
+ it { should_not protect_attributes(:name) }
12
+ end
13
+
14
+ describe Tag do
15
+ should_have_many :taggings, :dependent => :destroy
16
+ should_have_many :posts
17
+
18
+ should_ensure_length_at_least :name, 2
19
+
20
+ should_protect_attributes :secret
21
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Tagging do
4
+ it { should belong_to(:post) }
5
+ it { should belong_to(:tag) }
6
+ it { should belong_to(:post, :tag) }
7
+ end
8
+
9
+ describe Tagging do
10
+ should_belong_to :post
11
+ should_belong_to :tag
12
+ should_belong_to :post, :tag
13
+ end
@@ -0,0 +1,107 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe User do
4
+ fixtures :all
5
+
6
+ it { should have_many(:posts) }
7
+ it { should have_many(:dogs) }
8
+ it { should have_many(:friendships) }
9
+ it { should have_many(:friends) }
10
+ it { should have_many(:posts, :dogs, :friendships, :friends) }
11
+
12
+ it { should have_one(:address) }
13
+ it { should have_one(:address, :dependent => :destroy) }
14
+
15
+ it { should have_indices(:email, :name, [:email, :name]) }
16
+ it { should have_index(:age) }
17
+
18
+ it { should have_named_scope(:old, :conditions => "age > 50") }
19
+ it { should have_named_scope(:eighteen, :conditions => { :age => 18 }) }
20
+
21
+ it { should have_named_scope('recent(5)', :limit => 5) }
22
+ it { should have_named_scope('recent(1)', :limit => 1) }
23
+ it { should have_named_scope('recent_via_method(7)', :limit => 7) }
24
+
25
+ describe "when given an instance variable" do
26
+ before(:each) do
27
+ @count = 2
28
+ end
29
+ it { should have_named_scope("recent(#{@count})", :limit => 2) }
30
+ end
31
+
32
+ it { should_not allow_values_for(:email, "blah", "b lah") }
33
+ it { should allow_values_for(:email, "a@b.com", "asdf@asdf.com") }
34
+ it { should ensure_length_in_range(:email, 1..100) }
35
+ it { should ensure_value_in_range(:age, 1..100) }
36
+ it { should protect_attributes(:password) }
37
+ it { should have_class_methods(:find, :destroy) }
38
+ it { should have_instance_methods(:email, :age, :email=, :valid?) }
39
+
40
+ it { should have_db_columns(:name, :email, :age) }
41
+ it { should have_db_column(:name) }
42
+ it { should have_db_column(:id, :type => "integer", :primary => true) }
43
+ it { should have_db_column(:email, :type => "string", :default => nil, :precision => nil, :limit => 255,
44
+ :null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)') }
45
+
46
+ it { should require_acceptance_of(:eula) }
47
+ it { should require_unique_attributes(:email, :scoped_to => :name) }
48
+
49
+ it { should ensure_length_is(:ssn, 9, :message => "Social Security Number is not the right length") }
50
+ it { should only_allow_numeric_values_for(:ssn) }
51
+
52
+ it { should have_readonly_attributes(:name) }
53
+
54
+ it { should_not protect_attributes(:name, :age) }
55
+ end
56
+
57
+ describe User do
58
+ fixtures :all
59
+
60
+ should_have_many :posts
61
+ should_have_many :dogs
62
+ should_have_many :friendships
63
+ should_have_many :friends
64
+ should_have_many :posts, :dogs, :friendships, :friends
65
+
66
+ should_have_one :address
67
+ should_have_one :address, :dependent => :destroy
68
+
69
+ should_have_indices :email, :name, [:email, :name]
70
+ should_have_index :age
71
+
72
+ should_have_named_scope :old, :conditions => "age > 50"
73
+ should_have_named_scope :eighteen, :conditions => { :age => 18 }
74
+
75
+ should_have_named_scope 'recent(5)', :limit => 5
76
+ should_have_named_scope 'recent(1)', :limit => 1
77
+ should_have_named_scope 'recent_via_method(7)', :limit => 7
78
+
79
+ describe "when given an instance variable" do
80
+ before(:each) do
81
+ @count = 2
82
+ end
83
+ should_have_named_scope "recent(@count)", :limit => 2
84
+ end
85
+
86
+ should_not_allow_values_for :email, "blah", "b lah"
87
+ should_allow_values_for :email, "a@b.com", "asdf@asdf.com"
88
+ should_ensure_length_in_range :email, 1..100
89
+ should_ensure_value_in_range :age, 1..100
90
+ should_protect_attributes :password
91
+ should_have_class_methods :find, :destroy
92
+ should_have_instance_methods :email, :age, :email=, :valid?
93
+
94
+ should_have_db_columns :name, :email, :age
95
+ should_have_db_column :name
96
+ should_have_db_column :id, :type => "integer", :primary => true
97
+ should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
98
+ :null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)'
99
+
100
+ should_require_acceptance_of :eula
101
+ should_require_unique_attributes :email, :scoped_to => :name
102
+
103
+ should_ensure_length_is :ssn, 9, :message => "Social Security Number is not the right length"
104
+ should_only_allow_numeric_values_for :ssn
105
+
106
+ should_have_readonly_attributes :name
107
+ end
@@ -0,0 +1,25 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ # Pick a unique cookie name to distinguish our session data from others'
6
+ session :session_key => '_rails_root_session_id'
7
+
8
+ def ensure_logged_in
9
+ unless session[:logged_in]
10
+ respond_to do |accepts|
11
+ accepts.html do
12
+ flash[:error] = 'What do you think you\'re doing?'
13
+ redirect_to '/'
14
+ end
15
+ accepts.xml do
16
+ headers["Status"] = "Unauthorized"
17
+ headers["WWW-Authenticate"] = %(Basic realm="Web Password")
18
+ render :text => "Couldn't authenticate you", :status => '401 Unauthorized'
19
+ end
20
+ end
21
+ return false
22
+ end
23
+ return true
24
+ end
25
+ end
@@ -0,0 +1,85 @@
1
+ class PostsController < ApplicationController
2
+ before_filter :ensure_logged_in
3
+ before_filter :load_user
4
+
5
+ def index
6
+ @posts = @user.posts
7
+
8
+ respond_to do |format|
9
+ format.html # index.rhtml
10
+ format.xml { render :xml => @posts.to_xml }
11
+ format.rss do
12
+ headers['Content-Type'] = 'application/rss+xml'
13
+ session[:special] = '$2 off your next purchase'
14
+ session[:special_user_id] = @user.id
15
+ head :ok
16
+ end
17
+ end
18
+ end
19
+
20
+ def show
21
+ @post = @user.posts.find(params[:id])
22
+
23
+ respond_to do |format|
24
+ format.html { render :layout => 'wide' }
25
+ format.xml { render :xml => @post.to_xml }
26
+ end
27
+ end
28
+
29
+ def new
30
+ @post = @user.posts.build
31
+ render :layout => false
32
+ end
33
+
34
+ def edit
35
+ @post = @user.posts.find(params[:id])
36
+ end
37
+
38
+ def create
39
+ @post = @user.posts.build(params[:post])
40
+
41
+ respond_to do |format|
42
+ if @post.save
43
+ flash[:notice] = 'Post was successfully created.'
44
+ format.html { redirect_to user_post_url(@post.user, @post) }
45
+ format.xml { head :created, :location => user_post_url(@post.user, @post) }
46
+ else
47
+ format.html { render :action => "new" }
48
+ format.xml { render :xml => @post.errors.to_xml }
49
+ end
50
+ end
51
+ end
52
+
53
+ def update
54
+ @post = @user.posts.find(params[:id])
55
+
56
+ respond_to do |format|
57
+ if @post.update_attributes(params[:post])
58
+ flash[:notice] = 'Post was successfully updated.'
59
+ format.html { redirect_to user_post_url(@post.user, @post) }
60
+ format.xml { head :ok }
61
+ else
62
+ format.html { render :action => "edit" }
63
+ format.xml { render :xml => @post.errors.to_xml }
64
+ end
65
+ end
66
+ end
67
+
68
+ def destroy
69
+ @post = @user.posts.find(params[:id])
70
+ @post.destroy
71
+
72
+ flash[:notice] = "Post was removed"
73
+
74
+ respond_to do |format|
75
+ format.html { redirect_to user_posts_url(@post.user) }
76
+ format.xml { head :ok }
77
+ end
78
+ end
79
+
80
+ private
81
+
82
+ def load_user
83
+ @user = User.find(params[:user_id])
84
+ end
85
+ end