happy_path 0.0.1 → 0.0.2
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.
- checksums.yaml +8 -8
- data/lib/happy_path/version.rb +1 -1
- data/lib/happy_path.rb +5 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjViM2I0ZDk0NTFmMjY2YjFiYTZlOGZhM2Q5ODRkM2MxNDI4ZTNlMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGI4MGM5NTI4MTRkMGRhNGZhZWRjYjVmYTRiZjZjNTZlYjhhZWMzYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODJhODgzMzc1MGFlYTNhMGRhYmM2ZmQxODYwM2I2YmI0ZjVjYjI0MjhiNWI4
|
10
|
+
ZTBhNzE2Y2ZmNzE2NzYwMDU2N2I2ZThhNzQ4Zjk5MTVjNDA3NmNmZTcxMzIy
|
11
|
+
ZjA4YmY0MzYyOGY3MWZmYTA5NThmNzg0OTNkODYxMDA4NWMxZTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmE1M2I5MzAyNzBlNDRhMGEzMTM3YmViYmMzNDUxYjJmMDE5NzFjMTZmYzg4
|
14
|
+
M2FiMmFhNzNlNmE0OTE4OWRhMjYyZjlkZjM3YjAzZGZkNmYwZTJjNTg4ZDk2
|
15
|
+
MjcyZjhjODc0NTA2NTM3ZmFkN2RmNGZhZmNmMjI5OTNmM2NjYzc=
|
data/lib/happy_path/version.rb
CHANGED
data/lib/happy_path.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
require "happy_path/version"
|
2
|
-
|
3
1
|
module HappyPath
|
4
2
|
extend ActiveSupport::Concern
|
5
|
-
|
3
|
+
PATHS = ['first', 'last']
|
4
|
+
|
6
5
|
def setup_happy_path
|
7
6
|
rescue_from ActiveRecord::RecordNotFound, with: :happy_paths
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
def follow_happy_paths
|
10
|
+
define_method (:happy_paths) do |exception|
|
12
11
|
class_constant = controller_name.classify.constantize
|
13
|
-
raise exception unless
|
12
|
+
raise exception unless self.respond_to?(:show) && HappyPath::PATHS.include?(params[:id]) && !class_constant.count.zero?
|
14
13
|
redirect_to action: :show, id: class_constant.send(params[:id]).id
|
15
14
|
end
|
16
15
|
end
|