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: 41ab23db90fb61ccd58ab05f9942fe10cb25e311
4
- data.tar.gz: 786b5687f5795413435b1b67f7e968541ac900f9
3
+ metadata.gz: 1179bc927b2e8cd0cc3293d291aacff6ab58e6b4
4
+ data.tar.gz: 5fd8f1a47e8e01aaf97f1f38568eb5a06128532d
5
5
  SHA512:
6
- metadata.gz: 1ca83ff1eed5fd7593b5eeec43f353e2a864d816f2689965fa885bc9672d6b9c16745cd9ce568b14e8235b44c8eed601235987e8fbeb9dc74be97b23114a3615
7
- data.tar.gz: 5f94474f613650df773f6adb88e05672220bc5549a207571c472800cb1cda12417d59186dc55e90ad6222c000f54d6121768cfe27d1be3bd0efcf50912b74ac7
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)
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.4.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect