databound 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/databound/manager.rb +1 -1
- data/lib/databound/utils.rb +5 -1
- data/lib/databound/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cba727e2ab9d8e8ae6f7493aad47e28cac352592
|
4
|
+
data.tar.gz: d6791304413633e2abdaee1b737a77b1a9dfaea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63143f0d64ad79f6563425cd35b7a73a4e01d0c3b40b369476c34f77c52d54c64a2793f57b68f39970c8031f6706df4fdb038aacfd29ff3fbccc58cb6f0d008a
|
7
|
+
data.tar.gz: b6cdeca9c47ab71d89368ed45f2c10ee2f3eb715f693b3255264083982d25d9415c9fe1ee3723ae4ef947a5fb1ca81ab0cc682314d7c0ad4d953deb8c15e60e0
|
data/lib/databound/manager.rb
CHANGED
data/lib/databound/utils.rb
CHANGED
@@ -2,14 +2,18 @@ module Databound
|
|
2
2
|
class Utils
|
3
3
|
def self.create_controller_unless_exists(path, resource, opts)
|
4
4
|
return if exists?(path)
|
5
|
+
opts ||= {}
|
5
6
|
|
6
7
|
controller = Class.new(ApplicationController)
|
7
8
|
controller.send(:include, Databound)
|
8
9
|
controller.send(:define_method, :model) do
|
9
10
|
resource.to_s.classify.constantize
|
10
11
|
end
|
12
|
+
|
11
13
|
controller.send(:define_method, :permitted_columns) do
|
12
|
-
opts
|
14
|
+
opts.fetch(:permitted_columns) do
|
15
|
+
raise 'Specify permitted_columns in routes or the controller'
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
Object.const_set(controller_name(path), controller)
|
data/lib/databound/version.rb
CHANGED