rescue-dog 0.3.2 → 0.3.4
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 +4 -4
- data/README.md +1 -1
- data/config/locales/rescue.yml +8 -8
- data/lib/rescue/controller.rb +31 -43
- data/lib/rescue/controllers/action.rb +42 -17
- data/lib/rescue/controllers/dynamic.rb +1 -1
- data/lib/rescue/controllers/flash.rb +5 -3
- data/lib/rescue/controllers/static.rb +1 -1
- data/lib/rescue/version.rb +1 -1
- data/lib/rescue-dog.rb +0 -1
- data/spec/rescue/controller_spec.rb +84 -48
- data/spec/rescue/controllers/action_spec.rb +23 -40
- data/spec/rescue/controllers/flash_spec.rb +14 -17
- data/spec/test_case.rb +0 -8
- metadata +2 -3
- data/lib/rescue/controllers/parameter.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e2a7f7faf7befcd8fb279f982baa669fcf66964
|
4
|
+
data.tar.gz: 21ea12236b212cc34badb3351fe6892bff346f42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbfc2e1db3316d00f46c99ebf4a79c2e5b24e0e4cfc16512e2ce095da21b3c2927de1d0caa3ce556e590b3a16845a402782b44ab6be160729c3452654bcbbd89
|
7
|
+
data.tar.gz: b43644434d7c85cc0e5c1835b8a92c3769443a5f4bcafc610640a77b894f2e149ac09efde1d77c5ed32a93a86e27cf160cada1104be73239dc47f26258ad285c
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ $ gem install rescue-dog
|
|
28
28
|
|
29
29
|
## Simple CRUD Actions
|
30
30
|
|
31
|
-
1. Include `Rescue::Controller::Static`
|
31
|
+
1. Include `Rescue::Controller` (Rescue::Controller::Static` or `Rescue::Controller::Dynamic`).
|
32
32
|
2. Call `rescue_controller` method.
|
33
33
|
|
34
34
|
### Define Actions
|
data/config/locales/rescue.yml
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
en:
|
2
2
|
default:
|
3
3
|
flash:
|
4
|
-
success: "
|
5
|
-
error: "
|
4
|
+
success: "default success"
|
5
|
+
error: "default error"
|
6
6
|
|
7
7
|
views:
|
8
8
|
rescue:
|
9
9
|
action:
|
10
10
|
flash:
|
11
|
-
success: "
|
12
|
-
error: "
|
11
|
+
success: "rescue success"
|
12
|
+
error: "rescue error"
|
13
13
|
dog:
|
14
14
|
action:
|
15
15
|
flash:
|
16
|
-
success: "success"
|
17
|
-
error: "error"
|
16
|
+
success: "rescue/dog success"
|
17
|
+
error: "rescue/dog error"
|
18
18
|
|
19
19
|
rescue_dog:
|
20
20
|
action:
|
21
21
|
flash:
|
22
|
-
success: "
|
23
|
-
error: "
|
22
|
+
success: "rescue_dog success"
|
23
|
+
error: "rescue_dog error"
|
24
24
|
|
data/lib/rescue/controller.rb
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
module Rescue
|
3
3
|
module Controller
|
4
4
|
|
5
|
+
def self.included(base)
|
6
|
+
base.extend Rescue::Controller::ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
def rescue_respond call, params, options = {}
|
10
|
+
begin
|
11
|
+
send(call, params)
|
12
|
+
success_message = options[:success]||Flash.message(self, :success)
|
13
|
+
flash[:success] = success_message unless success_message.blank?
|
14
|
+
instance_exec(&options[:render])
|
15
|
+
rescue => e
|
16
|
+
Rails.logger.debug ([e.message] + e.backtrace).join("\n\t")
|
17
|
+
error_message = options[:error]||Flash.message(self, :error)
|
18
|
+
flash.now[:error] = error_message unless error_message.blank?
|
19
|
+
instance_exec(&options[:rescue])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
5
23
|
module ClassMethods
|
6
24
|
|
7
25
|
def rescue_associate *klasses, &block
|
@@ -37,54 +55,24 @@ module Rescue
|
|
37
55
|
end
|
38
56
|
|
39
57
|
def rescue_controller clazz, *actions
|
40
|
-
options
|
41
|
-
|
42
|
-
|
43
|
-
params_sym = :"#{name}_params"
|
44
|
-
|
45
|
-
Parameter.define(self)
|
46
|
-
Action.define(self, clazz, var_sym, params_sym)
|
58
|
+
options = actions.extract_options!
|
59
|
+
method_names = actions + options.keys
|
60
|
+
name = clazz.name.downcase
|
47
61
|
|
48
|
-
[:
|
49
|
-
|
50
|
-
|
62
|
+
[:show, :edit, :new].each do |type|
|
63
|
+
(options.delete(type)||[]).each do |name|
|
64
|
+
method_names << name
|
65
|
+
options[name] = { type: type }
|
66
|
+
end
|
51
67
|
end
|
52
|
-
end
|
53
68
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
options[:flash] ||= [:create, :update, :delete].include?(options[:type])
|
58
|
-
call_method = case options[:type]
|
59
|
-
when :show, :edit ; :find_call
|
60
|
-
else ; :"#{options[:type]}_call"
|
61
|
-
end
|
62
|
-
rescue_given = options[:rescue]||options[:error]||options[:flash]
|
63
|
-
success_message = options[:success]
|
64
|
-
error_message = options[:error]
|
65
|
-
if options[:flash]
|
66
|
-
success_message ||= Flash.message(self, name, :success)
|
67
|
-
error_message ||= Flash.message(self, name, :error)
|
69
|
+
[:create, :update, :destroy].each do |type|
|
70
|
+
options[type] ||= {}
|
71
|
+
options[type][:params] ||= :"#{type}_params"
|
68
72
|
end
|
69
73
|
|
70
|
-
|
71
|
-
|
72
|
-
begin
|
73
|
-
send(call_method, &options[:intercept])
|
74
|
-
flash[:success] = success_message unless success_message.blank?
|
75
|
-
instance_exec(&options[:render]) if options[:render]
|
76
|
-
rescue => e
|
77
|
-
Rails.logger.debug(e.backtrace.unshift(e.message).join("\n\t"))
|
78
|
-
flash.now[:error] = error_message unless error_message.blank?
|
79
|
-
instance_exec(&options[:rescue]) if options[:rescue]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
else
|
83
|
-
define_method name do
|
84
|
-
send(call_method)
|
85
|
-
instance_exec(&options[:render]) if options[:render]
|
86
|
-
end
|
87
|
-
end
|
74
|
+
Action.define_call(self, clazz, :"@#{name}")
|
75
|
+
Action.define(self, method_names, options)
|
88
76
|
end
|
89
77
|
|
90
78
|
end
|
@@ -3,31 +3,56 @@ module Rescue
|
|
3
3
|
module Controller
|
4
4
|
class Action
|
5
5
|
|
6
|
-
def self.
|
7
|
-
object.send(:define_method, :new_call) do
|
8
|
-
instance_variable_set(var_sym, clazz.new)
|
6
|
+
def self.define_call object, clazz, var_sym
|
7
|
+
object.send(:define_method, :new_call) do |params = {}|
|
8
|
+
instance_variable_set(var_sym, clazz.new(params))
|
9
9
|
end
|
10
|
-
object.send(:define_method, :find_call) do
|
11
|
-
id
|
12
|
-
instance_variable_set(var_sym, clazz.find(id))
|
10
|
+
object.send(:define_method, :find_call) do |params = {}|
|
11
|
+
id = (params.empty? ? send(:params) : params).delete(Rescue.config.primary_key)
|
12
|
+
instance_variable_set(var_sym, clazz.where(params).find(id))
|
13
13
|
end
|
14
|
-
object.send(:define_method, :create_call) do
|
15
|
-
|
16
|
-
instance_exec(&block) if block
|
14
|
+
object.send(:define_method, :create_call) do |params|
|
15
|
+
new_call(params)
|
17
16
|
instance_variable_get(var_sym).save!
|
18
17
|
end
|
19
|
-
object.send(:define_method, :update_call) do
|
18
|
+
object.send(:define_method, :update_call) do |params|
|
20
19
|
find_call
|
21
|
-
instance_variable_get(var_sym).attributes =
|
22
|
-
instance_exec(&block) if block
|
20
|
+
instance_variable_get(var_sym).attributes = params
|
23
21
|
instance_variable_get(var_sym).save!
|
24
22
|
end
|
25
|
-
object.send(:define_method, :
|
26
|
-
find_call
|
27
|
-
|
28
|
-
|
23
|
+
object.send(:define_method, :destroy_call) do |params|
|
24
|
+
find_call(params)
|
25
|
+
instance_variable_get(var_sym).destroy
|
26
|
+
end
|
27
|
+
object.send(:private, :new_call, :find_call, :create_call, :update_call, :destroy_call)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.define object, names, args = {}
|
31
|
+
names.each do |name|
|
32
|
+
options = args[name]||{}
|
33
|
+
type = options[:type]||name
|
34
|
+
raise RuntimeError "`name` is already defined." if object.private_method_defined?(name)
|
35
|
+
case type
|
36
|
+
when :show, :edit
|
37
|
+
object.send(:define_method, name) do
|
38
|
+
send(:find_call)
|
39
|
+
instance_exec(&options[:render]) if options[:render]
|
40
|
+
end
|
41
|
+
when :new
|
42
|
+
object.send(:define_method, name) do
|
43
|
+
params = options[:params] ? send(options[:params]) : {}
|
44
|
+
send(:new_call, params)
|
45
|
+
instance_exec(&options[:render]) if options[:render]
|
46
|
+
end
|
47
|
+
when :create, :update, :destroy
|
48
|
+
object.send(:define_method, name) do
|
49
|
+
params = send(options[:params]||:"#{name}_params")
|
50
|
+
rescue_respond(:"#{type}_call", params, options)
|
51
|
+
end
|
52
|
+
else
|
53
|
+
raise RuntimeError "Undefined action type `#{type}`."
|
54
|
+
end
|
29
55
|
end
|
30
|
-
object.send(:private, :new_call, :find_call, :create_call, :update_call, :delete_call)
|
31
56
|
end
|
32
57
|
|
33
58
|
end
|
@@ -3,9 +3,11 @@ module Rescue
|
|
3
3
|
module Controller
|
4
4
|
class Flash
|
5
5
|
|
6
|
-
def self.message object,
|
7
|
-
|
8
|
-
scope
|
6
|
+
def self.message object, key
|
7
|
+
scope = [:views]
|
8
|
+
scope += object.controller_path.split('/')
|
9
|
+
scope << object.action_name
|
10
|
+
scope << :flash
|
9
11
|
text(key, scope)
|
10
12
|
end
|
11
13
|
|
data/lib/rescue/version.rb
CHANGED
data/lib/rescue-dog.rb
CHANGED
@@ -3,7 +3,6 @@ require 'rescue/controller.rb'
|
|
3
3
|
require "rescue/controllers/static.rb"
|
4
4
|
require "rescue/controllers/dynamic.rb"
|
5
5
|
require "rescue/controllers/action.rb"
|
6
|
-
require "rescue/controllers/parameter.rb"
|
7
6
|
require "rescue/controllers/flash.rb"
|
8
7
|
require 'rescue/exceptions/application_error.rb'
|
9
8
|
require 'rescue/exceptions/respond_error.rb'
|
@@ -3,74 +3,110 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Rescue::Controller do
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
let(:object) do
|
7
|
+
Class.new ApplicationController do
|
8
|
+
include Rescue::Controller
|
9
|
+
rescue_controller RescueModel,
|
10
|
+
show: [:show_action],
|
11
|
+
edit: [:edit_action],
|
12
|
+
new: [:new_action],
|
13
|
+
create: { render: lambda { } ,rescue: lambda { } },
|
14
|
+
update: { render: lambda { } ,rescue: lambda { } },
|
15
|
+
destroy: { render: lambda { } ,rescue: lambda { } },
|
16
|
+
create_action: { type: :create ,render: lambda { } ,rescue: lambda { } },
|
17
|
+
update_action: { type: :update ,render: lambda { } ,rescue: lambda { } },
|
18
|
+
destroy_action: { type: :destroy ,render: lambda { } ,rescue: lambda { } }
|
19
|
+
|
20
|
+
def customized_create_action
|
21
|
+
rescue_respond(:create_call, create_params,
|
22
|
+
render: lambda { },
|
23
|
+
rescue: lambda { }
|
24
|
+
)
|
10
25
|
end
|
11
|
-
end
|
12
26
|
|
13
|
-
|
14
|
-
|
15
|
-
|
27
|
+
def customized_update_action
|
28
|
+
rescue_respond(:update_call, update_params,
|
29
|
+
render: lambda { return true },
|
30
|
+
rescue: lambda { }
|
31
|
+
)
|
16
32
|
end
|
17
|
-
end
|
18
|
-
end
|
19
33
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
def customized_destroy_action
|
35
|
+
rescue_respond(:destroy_call, destroy_params,
|
36
|
+
render: lambda { },
|
37
|
+
rescue: lambda { }
|
38
|
+
)
|
25
39
|
end
|
26
40
|
end
|
41
|
+
end
|
27
42
|
|
28
|
-
|
29
|
-
|
43
|
+
it "should be defined `rescue_respond`" do
|
44
|
+
expect(object.method_defined? :rescue_respond).to be_true
|
45
|
+
end
|
46
|
+
|
47
|
+
[:rescue_associate, :rescue_controller].each do |name|
|
48
|
+
it "should be able to call method `#{name}`" do
|
49
|
+
expect(object.public_methods.include? name).to be_true
|
30
50
|
end
|
51
|
+
end
|
31
52
|
|
32
|
-
|
33
|
-
|
34
|
-
|
53
|
+
|
54
|
+
describe "#rescue_respond" do
|
55
|
+
let(:object) do
|
56
|
+
clazz = Class.new ApplicationController do
|
57
|
+
include Rescue::Controller
|
35
58
|
end
|
59
|
+
object = clazz.new
|
60
|
+
object.stub(:flash).and_return({})
|
61
|
+
object.stub(:controller_path).and_return('rescue')
|
62
|
+
object.stub(:action_name).and_return('action')
|
63
|
+
object.stub(:stub_call).with({}).and_return(nil)
|
64
|
+
object
|
36
65
|
end
|
37
66
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
67
|
+
it "should be able to render" do
|
68
|
+
expect(
|
69
|
+
object.send(:rescue_respond, :stub_call, {},
|
70
|
+
render: lambda { return 'render' },
|
71
|
+
rescue: lambda { return 'rescue' })
|
72
|
+
).to eq('render')
|
42
73
|
end
|
43
74
|
|
44
|
-
|
45
|
-
context "when `rescue_controller` is called #{args}" do
|
46
|
-
options = args.extract_options!
|
47
|
-
methods = args + options.keys
|
75
|
+
end
|
48
76
|
|
49
|
-
|
50
|
-
|
51
|
-
extend Rescue::Controller::ClassMethods
|
52
|
-
rescue_controller RescueModel, *args.dup, options.dup
|
53
|
-
end
|
54
|
-
end
|
77
|
+
describe Rescue::Controller::ClassMethods do
|
78
|
+
describe "#rescue_controller" do
|
55
79
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
80
|
+
let(:object) do
|
81
|
+
Class.new ApplicationController do
|
82
|
+
extend Rescue::Controller::ClassMethods
|
83
|
+
rescue_controller RescueModel,
|
84
|
+
show: [:show_action],
|
85
|
+
edit: [:edit_action],
|
86
|
+
new: [:new_action],
|
87
|
+
create: { render: lambda { } ,rescue: lambda { } },
|
88
|
+
update: { render: lambda { } ,rescue: lambda { } },
|
89
|
+
destroy: { render: lambda { } ,rescue: lambda { } },
|
90
|
+
create_action: { type: :create ,render: lambda { } ,rescue: lambda { } },
|
91
|
+
update_action: { type: :update ,render: lambda { } ,rescue: lambda { } },
|
92
|
+
destroy_action: { type: :destroy ,render: lambda { } ,rescue: lambda { } }
|
60
93
|
end
|
94
|
+
end
|
61
95
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
expect(object.public_instance_methods.include? name).to be_true
|
66
|
-
end
|
67
|
-
else
|
68
|
-
it "should not be defined method `#{name}`" do
|
69
|
-
expect(object.instance_methods.include? name).to be_false
|
70
|
-
end
|
71
|
-
end
|
96
|
+
[:find_call, :new_call, :create_call, :update_call, :destroy_call].each do |name|
|
97
|
+
it "should be defined private method `#{name}`" do
|
98
|
+
expect(object.private_instance_methods.include? name).to be_true
|
72
99
|
end
|
73
100
|
end
|
101
|
+
|
102
|
+
[ :new, :edit, :show, :create, :update, :destroy,
|
103
|
+
:show_action, :edit_action, :new_action,
|
104
|
+
:create_action, :update_action, :destroy_action ].each do |name|
|
105
|
+
it "should be defined public method `#{name}`" do
|
106
|
+
expect(object.public_instance_methods.include? name).to be_true
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
74
110
|
end
|
75
111
|
end
|
76
112
|
|
@@ -9,58 +9,41 @@ describe Rescue::Controller::Action do
|
|
9
9
|
object = Object.new
|
10
10
|
object.stub(:attributes=).and_return(true)
|
11
11
|
object.stub(:save!).and_return(true)
|
12
|
-
object.stub(:destroy
|
12
|
+
object.stub(:destroy).and_return(true)
|
13
13
|
object
|
14
14
|
end
|
15
|
+
clazz.stub(:where).and_return(clazz)
|
15
16
|
clazz.stub(:find).and_return(clazz.new)
|
16
17
|
clazz
|
17
18
|
end
|
18
19
|
|
19
|
-
let(:controller) do # Fake Controller
|
20
|
-
clazz = model
|
21
|
-
Class.new do
|
22
|
-
Rescue::Controller::Action.define self, clazz, :@rescue, :rescue_params
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
let(:object) do
|
27
|
-
object = controller.new
|
28
|
-
object.stub(:find_params).and_return({})
|
29
|
-
object.stub(:rescue_params).and_return({})
|
30
|
-
object
|
31
|
-
end
|
32
|
-
|
33
|
-
let(:exception) do
|
34
|
-
Class.new(RuntimeError)
|
35
|
-
end
|
36
|
-
|
37
20
|
describe "#define" do
|
38
|
-
|
39
|
-
|
40
|
-
|
21
|
+
let(:controller) do # Fake Controller
|
22
|
+
clazz = model
|
23
|
+
Class.new do
|
24
|
+
Rescue::Controller::Action.define_call self, clazz, :@rescue
|
41
25
|
end
|
42
26
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
27
|
+
|
28
|
+
let(:object) do
|
29
|
+
object = controller.new
|
30
|
+
object.stub(:rescuemodel_params).and_return({})
|
31
|
+
object.stub(:params).and_return({})
|
32
|
+
object
|
48
33
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
it
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
it "should execute block-process" do
|
59
|
-
expect { object.send(name, &block) }.to raise_error(exception)
|
60
|
-
end
|
34
|
+
|
35
|
+
let(:params) { {} }
|
36
|
+
|
37
|
+
[:find_call, :new_call, :create_call, :update_call, :destroy_call].each do |name|
|
38
|
+
it "should be defined private method `#{name}`" do
|
39
|
+
expect(controller.private_instance_methods.include? name).to be_true
|
40
|
+
end
|
41
|
+
it "should not raise error" do
|
42
|
+
expect { object.send(name, params) }.not_to raise_error
|
61
43
|
end
|
62
|
-
|
63
44
|
end
|
45
|
+
|
64
46
|
end
|
65
47
|
|
66
48
|
end
|
49
|
+
|
@@ -3,26 +3,23 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Rescue::Controller::Flash do
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
Rescue.const_set :DogController, Class.new {}
|
12
|
-
end
|
6
|
+
describe "#message" do
|
7
|
+
['default', 'rescue', 'rescue/dog'].each do |name|
|
8
|
+
context "when #{{ controller: name, action: :action }}" do
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
let(:controller) do
|
11
|
+
clazz = Class.new
|
12
|
+
clazz.stub(:controller_path).and_return(name)
|
13
|
+
clazz.stub(:controller_name).and_return(name)
|
14
|
+
clazz.stub(:action_name).and_return(:action)
|
15
|
+
clazz
|
19
16
|
end
|
20
|
-
end
|
21
|
-
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
[:success, :error].each do |status|
|
19
|
+
it do
|
20
|
+
expect(Rescue::Controller::Flash.message(controller, status)).to eq("#{name} #{status}")
|
21
|
+
end
|
22
|
+
end
|
26
23
|
end
|
27
24
|
end
|
28
25
|
end
|
data/spec/test_case.rb
CHANGED
@@ -4,14 +4,6 @@ class TestCase
|
|
4
4
|
ERRORS = { BadRequest: 400, Unauthorized: 401, NotFound: 404, ServerError: 500 }
|
5
5
|
FORMATS = [Mime::Type.new("text/html", :html), Mime::Type.new("application/json", :json)]
|
6
6
|
|
7
|
-
RESCUE_OPTIONS = [
|
8
|
-
[],
|
9
|
-
[:show],
|
10
|
-
[:new, :show, :create],
|
11
|
-
[:new, :show, :edit, :create, :update],
|
12
|
-
[:new, :show, :edit, { create: {}, update: {}, delete: {} }],
|
13
|
-
]
|
14
|
-
|
15
7
|
FLASHS = [:DefaultController, :RescueController, :RescueDogController]
|
16
8
|
end
|
17
9
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yulii
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -51,7 +51,6 @@ files:
|
|
51
51
|
- lib/rescue/controllers/action.rb
|
52
52
|
- lib/rescue/controllers/dynamic.rb
|
53
53
|
- lib/rescue/controllers/flash.rb
|
54
|
-
- lib/rescue/controllers/parameter.rb
|
55
54
|
- lib/rescue/controllers/static.rb
|
56
55
|
- lib/rescue/exceptions/application_error.rb
|
57
56
|
- lib/rescue/exceptions/respond_error.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# coding: UTF-8
|
2
|
-
module Rescue
|
3
|
-
module Controller
|
4
|
-
class Parameter
|
5
|
-
|
6
|
-
def self.define object
|
7
|
-
id = Rescue.config.primary_key
|
8
|
-
object.send(:define_method, :find_params) do
|
9
|
-
params.require(id)
|
10
|
-
params.permit(id)
|
11
|
-
end
|
12
|
-
object.send(:private, :find_params)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|