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 !
implement make_resourceful style syntax called: resource_controller [#1 
state:resolved]

git-svn-id: http://svn.jamesgolick.com/resource_controller/trunk@81 
a0c33c4f-3f3c-0410-8ba4-d3650ac1a399
james (author)
Sun Oct 28 17:19:37 -0700 2007
commit  367ab4d0bf3ccfe2e5b59cd60ef916814d67e386
tree    a04887be9ef72520fd76768225a920f6339ce0b0
parent  21902e6ae1fe5f54a3eef88a36b6df03934f877e
...
1
2
3
4
5
 
 
 
...
1
2
3
 
4
5
6
7
0
@@ -1,4 +1,6 @@
0
 ActionController::Base.class_eval do
0
   include Urligence
0
   helper_method :smart_url
0
-end
0
\ No newline at end of file
0
+
0
+ extend ResourceController::ActionControllerExtension
0
+end
...
1
2
3
 
 
 
 
 
 
4
5
...
1
2
3
4
5
6
7
8
9
10
11
0
@@ -1,4 +1,10 @@
0
 module ResourceController
0
   ACTIONS = [:index, :show, :new_action, :create, :edit, :update, :destroy].freeze
0
   FAILABLE_ACTIONS = ACTIONS - [:index, :new_action, :edit].freeze
0
+
0
+ module ActionControllerExtension
0
+ def resource_controller
0
+ include ResourceController::Controller
0
+ end
0
+ end
0
 end
0
\ No newline at end of file
...
9
10
11
12
 
13
14
15
16
...
9
10
11
 
12
13
14
15
16
0
@@ -9,7 +9,7 @@ module ResourceController
0
     
0
     def self.inherited(subclass)
0
       super
0
- subclass.class_eval { include ResourceController::Controller }
0
+ subclass.class_eval { resource_controller }
0
     end
0
   end
0
 end
0
\ No newline at end of file
...
1
 
 
2
3
4
...
1
2
3
4
5
6
0
@@ -1,4 +1,6 @@
0
 ActionController::Routing::Routes.draw do |map|
0
+ map.resources :projects
0
+
0
   map.resources :people
0
   
0
   map.resources :dudes, :controller => "users"
...
2
3
4
5
 
6
7
8
...
38
39
40
 
 
 
 
41
42
43
...
2
3
4
 
5
6
7
8
...
38
39
40
41
42
43
44
45
46
47
0
@@ -2,7 +2,7 @@
0
 # migrations feature of ActiveRecord to incrementally modify your database, and
0
 # then regenerate this schema definition.
0
 
0
-ActiveRecord::Schema.define(:version => 9) do
0
+ActiveRecord::Schema.define(:version => 10) do
0
 
0
   create_table "accounts", :force => true do |t|
0
     t.column "name", :string
0
@@ -38,6 +38,10 @@ ActiveRecord::Schema.define(:version => 9) do
0
     t.column "name", :string
0
   end
0
 
0
+ create_table "projects", :force => true do |t|
0
+ t.column "title", :string
0
+ end
0
+
0
   create_table "somethings", :force => true do |t|
0
     t.column "title", :string
0
   end

Comments

    No one has commented yet.