effective_resources 0.4.1 → 0.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1179bc927b2e8cd0cc3293d291aacff6ab58e6b4
|
4
|
+
data.tar.gz: 5fd8f1a47e8e01aaf97f1f38568eb5a06128532d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f407ebc649b42b9ecbbe766621cdce2f6290dd9ebffd316da013a0d76dce7a5b2e30c7265dd8414fb56fea3e01e4598ed8c3a539f7b0dc4063b8e6a97f51c3e1
|
7
|
+
data.tar.gz: ff419e84356ea9b20916dd404ed9afaf966228ed7f4c578637127f51eab77785bb5a895ef31f1d4b4f87deb3d7bbbe83b061f6811878da10c26e9ed718bc516e
|
@@ -64,6 +64,10 @@ module Effective
|
|
64
64
|
def new
|
65
65
|
self.resource ||= resource_class.new
|
66
66
|
|
67
|
+
self.resource.assign_attributes(
|
68
|
+
params.to_unsafe_h.except(:controller, :action).select { |k, v| resource.respond_to?("#{k}=") }
|
69
|
+
)
|
70
|
+
|
67
71
|
@page_title ||= "New #{resource_name.titleize}"
|
68
72
|
EffectiveResources.authorized?(self, :new, resource)
|
69
73
|
end
|
@@ -74,6 +78,8 @@ module Effective
|
|
74
78
|
@page_title ||= "New #{resource_name.titleize}"
|
75
79
|
EffectiveResources.authorized?(self, :create, resource)
|
76
80
|
|
81
|
+
resource.created_by ||= current_user if resource.respond_to?(:created_by=)
|
82
|
+
|
77
83
|
if resource.save
|
78
84
|
flash[:success] = "Successfully created #{resource_human_name}"
|
79
85
|
redirect_to(resource_redirect_path)
|