decko 0.6.1 → 0.6.2

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: aeacf2fbbf0981f2cee104c70ae92aa444ebaac7
4
- data.tar.gz: f1eb236d57cf919828baeea2ee765b96a7d42fa1
3
+ metadata.gz: 25be09f089dcb1105f21d9c37c4b4d62246e1d66
4
+ data.tar.gz: b81fc0417586e3d2c817f38776a72d26b9ac0c1b
5
5
  SHA512:
6
- metadata.gz: d877cc738c99466edc35464b075ea017bfe1fe48d2c322767c190ae2a61627c17cb59fcf0f9d91d20e784f809ccbc7e804ab0c2757450711c5b94f13082c853d
7
- data.tar.gz: db58b0aecd2e3f1a9a59b714ff2925ade4bc3b64218fad93185f4df246cf0850be88dd13b2056787ba9087a226eb3e9ecba8fcba25fa5fb00b8579b0a712eda3
6
+ metadata.gz: f7cb7af63f6a29ff8fedbac65cad06137a2659c6b21c32788de6a420ef5476ce8da1d0bb4081cc84ac312b98b9d981f9059f886a075613f7e583d93e7c580ba0
7
+ data.tar.gz: c7733d3d88ee69f7bc7970f1a650eaf6762959eaae7ea1437ddbf17e5143b34dab0cc5b158ffa7e060b29ee8cc5ba2389847b464c58ecdc5872a106fb1ff0d75
@@ -18,7 +18,7 @@ class CardController < ActionController::Base
18
18
  # PUBLIC METHODS
19
19
 
20
20
  def create
21
- handle { card.save }
21
+ handle { card.save! }
22
22
  end
23
23
 
24
24
  def read
@@ -26,11 +26,11 @@ class CardController < ActionController::Base
26
26
  end
27
27
 
28
28
  def update
29
- card.new_card? ? create : handle { card.update_attributes params[:card] }
29
+ card.new_card? ? create : handle { card.update_attributes! params[:card] }
30
30
  end
31
31
 
32
32
  def delete
33
- handle { card.delete }
33
+ handle { card.delete! }
34
34
  end
35
35
 
36
36
  # @deprecated
@@ -69,20 +69,14 @@ class CardController < ActionController::Base
69
69
  end
70
70
 
71
71
  def load_card
72
- handle_errors do
73
- @card = Card.controller_fetch params
74
- raise Card::Error::NotFound unless card
75
- record_as_main
76
- end
72
+ @card = Card.controller_fetch params
73
+ raise Card::Error::NotFound unless card
74
+ record_as_main
77
75
  end
78
76
 
79
77
  def load_action
80
- handle_errors do
81
- card.select_action_by_params params
82
- if params[:edit_draft] && card.drafts.present?
83
- card.content = card.last_draft_content
84
- end
85
- end
78
+ card.select_action_by_params params
79
+ card.content = card.last_draft_content if params[:edit_draft] && card.drafts.present?
86
80
  end
87
81
 
88
82
  # TODO: refactor this away this when new layout handling is ready
@@ -98,15 +92,10 @@ class CardController < ActionController::Base
98
92
 
99
93
  def handle
100
94
  card.act(success: true) do
101
- yield ? render_success : render_errors
95
+ yield ? render_success : raise(Card::Error::UserError)
102
96
  end
103
97
  end
104
98
 
105
- def handle_errors
106
- yield
107
- card.errors.any? ? render_errors : true
108
- end
109
-
110
99
  # successful create, update, or delete action
111
100
  def render_success
112
101
  success = Card::Env.success.in_context card.name
@@ -132,14 +121,11 @@ class CardController < ActionController::Base
132
121
  end
133
122
  end
134
123
 
135
- def render_errors
136
- view, status = Card::Error.view_and_status(card) || [:errors, 422]
137
- show view, status
138
- end
139
-
140
124
  rescue_from StandardError do |exception|
141
- Rails.logger.info "exception = #{exception.class}: #{exception.message}"
142
125
  @card ||= Card.new
143
- show Card::Error.exception_view(@card, exception)
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
144
130
  end
145
131
  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.1
4
+ version: 0.6.2
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-08-20 00:00:00.000000000 Z
14
+ date: 2018-09-25 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.1
22
+ version: 1.96.2
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.1
29
+ version: 1.96.2
30
30
  description: a wiki approach to stuctured data, dynamic interaction, and web design
31
31
  email:
32
32
  - info@decko.org