decko 0.6.5 → 0.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6d4b5cc0477c68446976ca04a09700a6b4660cf
4
- data.tar.gz: a97b8e3f1cca8cec30ea112bc57ec7a3aacdaa28
3
+ metadata.gz: 9c7470e38fb2ea83657b0a479d24ea5c682f357c
4
+ data.tar.gz: 981f6171d85c98551cbc02b3df6f65941eb9c785
5
5
  SHA512:
6
- metadata.gz: 5b28f42af4aba65c07171a69064b8627c253b0a569f31ac30774986c800cf9972fbdededfa0ce88788c746c9026a958cffc74a28bfcf99669c28f213a75d06cf
7
- data.tar.gz: de20f2db80df6223c6efe1c313a7305b81ecb2ca2e8f6cef6b5bc4465203ceadf0e19909d06d2066e61571aa9b7ee6cf15b1fb0a2348242d70d2dc7405db83a2
6
+ metadata.gz: febc67212bd21e942d57aaa635c4c270d2a2635b43f448138daf9b2cb31312cf7eda6f0ab7e28520227d57e5835aae760e8055909af0130f6574c56e1d390c61
7
+ data.tar.gz: 61bd7956343a66cc2f14fee2232aefb6eb2b99de31e6bba70a5607f7eb7f1e609bb946588958f8b157362e926ac391030962816253f3eafaea61b2deeb7e0d9f
@@ -65,10 +65,14 @@ module Decko
65
65
  # Both this file and that would make sense as submodules of CardController
66
66
 
67
67
  def load_format
68
- request.format = :html if Card::Env.ajax? && !params[:format]
68
+ request.format = :html if implicit_html?
69
69
  card.format format_name_from_params
70
70
  end
71
71
 
72
+ def implicit_html?
73
+ (Card::Env.ajax? && !params[:format]) || request.format.to_s == "*/*"
74
+ end
75
+
72
76
  def format_name_from_params
73
77
  explicit_file_format? ? :file : request.format.to_sym
74
78
  end
@@ -121,13 +121,20 @@ class CardController < ActionController::Base
121
121
  end
122
122
  end
123
123
 
124
- unless Rails.env.development?
125
- rescue_from StandardError do |exception|
126
- @card ||= Card.new
127
- Card::Error.current = exception
128
- error = Card::Error.cardify_exception exception, card
129
- error.report
130
- show error.class.view, error.class.status_code
124
+ def handle_exception exception
125
+ @card ||= Card.new
126
+ Card::Error.current = exception
127
+ error = Card::Error.cardify_exception exception, card
128
+ error.report
129
+ show error.class.view, error.class.status_code
130
+ end
131
+
132
+ class << self
133
+ def rescue_from_class klass
134
+ rescue_from(klass) { |exception| handle_exception exception }
131
135
  end
132
136
  end
137
+
138
+ rescue_from_class ActiveRecord::RecordInvalid
139
+ rescue_from_class(Rails.env.development? ? Card::Error::UserError : StandardError)
133
140
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-11-25 00:00:00.000000000 Z
14
+ date: 2018-11-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: card
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.96.5
22
+ version: 1.96.6
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.96.5
29
+ version: 1.96.6
30
30
  description: a wiki approach to stuctured data, dynamic interaction, and web design
31
31
  email:
32
32
  - info@decko.org