giraffesoft-resource_controller 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc
CHANGED
@@ -116,6 +116,12 @@ If you want to create a singleton RESTful controller inherit from ResourceContro
|
|
116
116
|
class AccountsController < ResourceController::Singleton
|
117
117
|
end
|
118
118
|
|
119
|
+
...or if need to inherit from some other class:
|
120
|
+
|
121
|
+
class AccountsController < ApplicationController
|
122
|
+
resource_controller :singleton
|
123
|
+
end
|
124
|
+
|
119
125
|
*Note:* This type of controllers handle a single resource only so the index action and all the collection helpers (collection_url, collection_path...) are not available for them.
|
120
126
|
|
121
127
|
Loading objects in singletons is similar to plural controllers with one exception. For non-nested singleton controllers you should override the object method as it defaults to nil for them.
|
data/VERSION.yml
CHANGED
@@ -11,20 +11,20 @@ describe <%= controller_class_name %>Controller do
|
|
11
11
|
route_for(:controller => "<%= table_name %>", :action => "new").should == "/<%= table_name %>/new"
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should map { :controller => '<%= table_name %>', :action => 'show', :id => 1
|
15
|
-
route_for(:controller => "<%= table_name %>", :action => "show", :id => 1).should == "/<%= table_name %>/1"
|
14
|
+
it "should map { :controller => '<%= table_name %>', :action => 'show', :id => '1'} to /<%= table_name %>/1" do
|
15
|
+
route_for(:controller => "<%= table_name %>", :action => "show", :id => "1").should == "/<%= table_name %>/1"
|
16
16
|
end
|
17
17
|
|
18
|
-
it "should map { :controller => '<%= table_name %>', :action => 'edit', :id => 1 } to /<%= table_name %>/1<%= resource_edit_path %>" do
|
19
|
-
route_for(:controller => "<%= table_name %>", :action => "edit", :id => 1).should == "/<%= table_name %>/1<%= resource_edit_path %>"
|
18
|
+
it "should map { :controller => '<%= table_name %>', :action => 'edit', :id => '1' } to /<%= table_name %>/1<%= resource_edit_path %>" do
|
19
|
+
route_for(:controller => "<%= table_name %>", :action => "edit", :id => "1").should == "/<%= table_name %>/1<%= resource_edit_path %>"
|
20
20
|
end
|
21
21
|
|
22
|
-
it "should map { :controller => '<%= table_name %>', :action => 'update', :id => 1} to /<%= table_name %>/1" do
|
23
|
-
route_for(:controller => "<%= table_name %>", :action => "update", :id => 1).should == "/<%= table_name %>/1"
|
22
|
+
it "should map { :controller => '<%= table_name %>', :action => 'update', :id => '1' } to /<%= table_name %>/1" do
|
23
|
+
route_for(:controller => "<%= table_name %>", :action => "update", :id => "1").should == {:path => "/<%= table_name %>/1", :method => :put}
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should map { :controller => '<%= table_name %>', :action => 'destroy', :id => 1} to /<%= table_name %>/1" do
|
27
|
-
route_for(:controller => "<%= table_name %>", :action => "destroy", :id => 1).should == "/<%= table_name %>/1"
|
26
|
+
it "should map { :controller => '<%= table_name %>', :action => 'destroy', :id => '1' } to /<%= table_name %>/1" do
|
27
|
+
route_for(:controller => "<%= table_name %>", :action => "destroy", :id => "1").should == {:path => "/<%= table_name %>/1", :method => :delete}
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -11,9 +11,9 @@ describe "/<%= table_name %>/index.<%= default_file_extension %>" do
|
|
11
11
|
<% end -%><% end %>
|
12
12
|
assigns[:<%= table_name %>] = [<%= file_name %>_98, <%= file_name %>_99]
|
13
13
|
|
14
|
-
template.stub!(:object_url).and_return(<%= file_name %>_path(
|
14
|
+
template.stub!(:object_url).and_return(<%= file_name %>_path(<%= file_name %>_99))
|
15
15
|
template.stub!(:new_object_url).and_return(new_<%= file_name %>_path)
|
16
|
-
template.stub!(:edit_object_url).and_return(edit_<%= file_name %>_path(
|
16
|
+
template.stub!(:edit_object_url).and_return(edit_<%= file_name %>_path(<%= file_name %>_99))
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should render list of <%= table_name %>" do
|