inherited_resources 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -257,6 +257,21 @@ give a block that expects two arguments, the first will be executed only in
257
257
  success scenarios and the second in failure scenarios. You keep everything
258
258
  clean and organized inside the same action.
259
259
 
260
+ == Success and failure scenarios on destroy
261
+
262
+ The destroy action can also fail, this usually happens when you have a
263
+ before_destroy callback in your model which returns false. However, in
264
+ order to tell InheritedResources that it really failed, you need to add
265
+ errors to your model. So your before_destroy callback on the model should
266
+ be something like this:
267
+
268
+ def before_destroy
269
+ if cant_be_destroyed?
270
+ errors.add(:base, "not allowed")
271
+ false
272
+ end
273
+ end
274
+
260
275
  == Some DSL
261
276
 
262
277
  For those DSL lovers, InheritedResources won't leave you alone. You can overwrite
@@ -22,6 +22,7 @@ module InheritedResources
22
22
 
23
23
  # Add at least :html mime type
24
24
  respond_to :html
25
+ self.responder = InheritedResources::Responder
25
26
 
26
27
  helper_method :collection_url, :collection_path, :resource_url, :resource_path,
27
28
  :new_resource_url, :new_resource_path, :edit_resource_url, :edit_resource_path,
@@ -39,6 +40,5 @@ module InheritedResources
39
40
  end
40
41
 
41
42
  inherit_resources(self)
42
- self.responder = InheritedResources::Responder
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module InheritedResources
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inherited_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jos\xC3\xA9 Valim"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-23 00:00:00 +01:00
12
+ date: 2009-12-29 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency