public
Rubygem
Description: Rails RESTful controller abstraction plugin.
Homepage: http://jamesgolick.com/resource_controller
Clone URL: git://github.com/giraffesoft/resource_controller.git
Click here to lend your support to: resource_controller and make a donation at www.pledgie.com !
refactor away the request safety built in to the controller
giraffesoft (author)
Wed May 07 19:08:08 -0700 2008
commit  0a8903d9de26da9158882486b9735251ae6e8de4
tree    c9e52b2c9f5162c9afa29da7fcf90f3e2b742677
parent  6202b9bed08f1a9f1052cb7f263efe5ee4e2a919
...
10
11
12
13
 
14
15
16
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
10
11
12
 
13
14
15
16
...
18
19
20
 
 
 
 
 
 
 
 
 
21
 
22
23
0
@@ -10,7 +10,7 @@ module ResourceController
0
       # Only execute the action on a non-GET request. This provides safety, and also
0
       # the ability to create a "login" method that both prints the form and handles
0
       # the login action, but only runs the action code on POST.
0
- if request.method == :get or action action_name
0
+ if action action_name
0
         after action_name
0
         set_flash action_name
0
         response_for action_name
0
@@ -18,16 +18,6 @@ module ResourceController
0
         set_flash action_name, :failure => true
0
         response_for action_name, :failure => true
0
       end
0
- rescue Exception => e
0
- # roundabout way due to Ruby losing special Exception class
0
- if rescues(action_name).include? e.class
0
- @exception = e # provide access to controller
0
- set_flash action_name, :failure => true
0
- response_for action_name, :failure => true
0
- else
0
- raise
0
- end
0
     end
0
-
0
   end
0
 end
...
44
45
46
47
 
48
49
50
...
44
45
46
 
47
48
49
50
0
@@ -44,7 +44,7 @@ module ResourceController::Helpers::Internal
0
 
0
     # Executes the action block
0
     def action(action_name)
0
- invoke_callbacks *self.class.send(action_name).action
0
+ self.class.send(action_name).action.nil? ? true : invoke_callbacks(*self.class.send(action_name).action)
0
     end
0
     
0
     # Returns a list of those exceptions which the call rescues
...
55
56
57
58
59
60
61
62
63
64
...
55
56
57
 
 
 
 
 
58
59
0
@@ -55,10 +55,5 @@ class TagsControllerTest < Test::Unit::TestCase
0
     should_be_restful do |resource|
0
       resource.formats = [:html]
0
     end
0
-
0
- should "render text for a missing object" do
0
- get :show, :id => 50000
0
- assert @response.body.match(/not found/i), @response.body
0
- end
0
   end
0
 end

Comments

    No one has commented yet.