rescue-dog 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rescue/controller.rb +1 -1
- data/lib/rescue/controllers/action.rb +5 -5
- data/lib/rescue/version.rb +1 -1
- data/spec/rescue/controller_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3a42dd86129f4cf07ae57061dcab37b4a31ed3f
|
4
|
+
data.tar.gz: 915c4f99aac405de93481767e16fac4dcc05db75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d2def423a21a162a182898001c0b0c793860fb4648128ce0a58fe3c70f0f9abec69dc9fe4a36e7838b1baa1d200adc023bd5db20a22329ddf400871dad33c9f
|
7
|
+
data.tar.gz: 3c4a5ffee5f17f2fa1c43b0f5919fac2db2a36d053367d95df9bfda1a5acb0f8c02191f64951061e90d606c736b9786d503ce5bef5430b557c086f147f48a1a6
|
data/lib/rescue/controller.rb
CHANGED
@@ -9,7 +9,7 @@ module Rescue
|
|
9
9
|
|
10
10
|
def rescue_respond call, params, options = {}
|
11
11
|
begin
|
12
|
-
send(call, params)
|
12
|
+
send(call, params, (options[:validate] ? { context: options[:validate] } : {}))
|
13
13
|
success_message = options[:success]||Flash.message(self, :success)
|
14
14
|
flash[:success] = success_message unless success_message.blank?
|
15
15
|
instance_exec(&options[:render])
|
@@ -11,16 +11,16 @@ module Rescue
|
|
11
11
|
id = (params.empty? ? send(:params) : params).delete(Rescue.config.primary_key)
|
12
12
|
instance_variable_set(var_sym, clazz.where(params).find(id))
|
13
13
|
end
|
14
|
-
object.send(:define_method, :create_call) do |params|
|
14
|
+
object.send(:define_method, :create_call) do |params, validate = {}|
|
15
15
|
new_call(params)
|
16
|
-
instance_variable_get(var_sym).save!
|
16
|
+
instance_variable_get(var_sym).save!(validate)
|
17
17
|
end
|
18
|
-
object.send(:define_method, :update_call) do |params|
|
18
|
+
object.send(:define_method, :update_call) do |params, validate = {}|
|
19
19
|
find_call
|
20
20
|
instance_variable_get(var_sym).attributes = params
|
21
|
-
instance_variable_get(var_sym).save!
|
21
|
+
instance_variable_get(var_sym).save!(validate)
|
22
22
|
end
|
23
|
-
object.send(:define_method, :destroy_call) do |params|
|
23
|
+
object.send(:define_method, :destroy_call) do |params, validate = {}|
|
24
24
|
find_call(params)
|
25
25
|
instance_variable_get(var_sym).destroy
|
26
26
|
end
|
data/lib/rescue/version.rb
CHANGED
@@ -150,7 +150,7 @@ describe Rescue::Controller do
|
|
150
150
|
object.stub(:flash).and_return(flash)
|
151
151
|
object.stub(:controller_path).and_return('rescue')
|
152
152
|
object.stub(:action_name).and_return('action')
|
153
|
-
object.stub(:stub_call).with({}).and_return(nil)
|
153
|
+
object.stub(:stub_call).with({},{}).and_return(nil)
|
154
154
|
object
|
155
155
|
end
|
156
156
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rescue-dog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yulii
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|