destroyed_at 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb825af31fcc38174f287636b93d18b81e14304e
4
- data.tar.gz: b3ff1f1fea7d4b1a7c6d08637f891cfdf069b122
3
+ metadata.gz: dcb907905ded6d91d8608d0946fd0e47dc6e40a5
4
+ data.tar.gz: 2ee4044301299b5e5b503b1419b28646713a7f37
5
5
  SHA512:
6
- metadata.gz: 7d3261f0ff7ab631122308add947cdf6b6e3dccfcbb274453db7b8905b7888babbfda33b76bb412b5056ffbc4019d7b59d53f9423f930a8b14fa668279f55754
7
- data.tar.gz: 7e3edf023b3691dd43033a61f3ee287b36e3f73ec3120f1f300dc3a0cb2681e16ee744e931a9aa9435a2d71c04ec5a2059dc762acba6948b86eb5f3715aec2cc
6
+ metadata.gz: 7febe07d4630e309263f8cb3575d898e9c4d22239a36d6befe37d02065d8bf8f7fd32b748fe1f536dd65c8f5fdc3821efb22836113a0f33ca5571604f6688f44
7
+ data.tar.gz: 4ff52345686b2a891b04556d22f8b77ff1a0e556f098c22b48de85cd00260b25e7dfd9d2f339a5ed20a82848dbb86ef3bb82fcd5500b97e279bededd3ee59aed
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.3.1
2
+
3
+ * [Bug] Fixed route not raising when resource constant does not exist -
4
+ Brian Cardarella
5
+
1
6
  ## 0.3.0
2
7
 
3
8
  * Fix issue with has_many destroy against regular models - Brian
@@ -14,7 +14,9 @@ ActionDispatch::Routing::Mapper.send(:prepend, DestroyedAt::Routes)
14
14
  module DestroyedAt::Resource
15
15
  def default_actions
16
16
  actions = super
17
- if self.name.camelcase.singularize.constantize.included_modules.include?(DestroyedAt)
17
+ class_name = self.name.camelcase.singularize
18
+
19
+ if Module.const_defined?(class_name) && class_name.constantize.included_modules.include?(DestroyedAt)
18
20
  actions << :restore
19
21
  end
20
22
 
@@ -1,3 +1,3 @@
1
1
  module DestroyedAt
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/test/mapper_test.rb CHANGED
@@ -3,6 +3,8 @@ require 'action_dispatch'
3
3
  require 'action_dispatch/routing/route_set'
4
4
  require 'action_controller'
5
5
 
6
+ class CarsController < ActionController::Base; end
7
+ class AuthorsController < ActionController::Base; end
6
8
  class CommentsController < ActionController::Base; end
7
9
 
8
10
  class MapperTest < ActiveSupport::TestCase
@@ -56,6 +58,19 @@ class MapperTest < ActiveSupport::TestCase
56
58
  end
57
59
  end
58
60
 
61
+ test 'does not raise if contstant does not exist for resource' do
62
+ draw do
63
+ resources :cars
64
+ end
65
+
66
+ begin
67
+ @set.recognize_path('/cars', method: 'get')
68
+ assert true, 'path recognized'
69
+ rescue ActionController::RoutingError
70
+ assert false, 'this should not be reached'
71
+ end
72
+ end
73
+
59
74
  private
60
75
 
61
76
  def draw(&block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: destroyed_at
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Dupuis Jr.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2013-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord