strong_form 0.0.2 → 0.0.3

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: 3a9441ee5ebf5e65f21e6f9ad3089a71d37bf394
4
- data.tar.gz: 6a22f5bd9548bf627225aeb4d7855a91f99b1e26
3
+ metadata.gz: 2a4b92dbd144d13249f5a77baf5ed520b56a41f2
4
+ data.tar.gz: 7111499d4467203c84232c2d29926b83482b3864
5
5
  SHA512:
6
- metadata.gz: 4e6f0b3c3378364d77e4cb997d6523fe6e612fffdcfd2386338423b53d631070ce0122ad6f1a970ee35e75d7fb1e7ac71e4fab1aa0783c81a4a61db0216dcfbf
7
- data.tar.gz: 1a7a85c7d615da3b65696dc300217ed136f9365c74389be76ce1b5a394927dbf7daeb552953b7dbaf94db6bdbe4bf9a55488c52b87ebc4c5146314fb4a36048f
6
+ metadata.gz: f12718f5019d565731035884ceaf08913945306e262bb42f7e5b12fbb1417d65157431c3cf521f1219898e1a15496fe8558bcaa19c146f50cf4defabdf682fce
7
+ data.tar.gz: 029cca5e49b51bf56faff61a8f30e0785fcd25018ebb4084e1a8b7e9d1d6f649c54f006ea55eff0f934b79f54aa167e98e61dd904467c95f659e25abd2362d0b
data/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Change Log
2
+
3
+ ## master
4
+
5
+ ## 0.0.3
6
+
7
+ ### Bugs fixed
8
+
9
+ * Rename `permitted_attributes` to `_strong_form_permitted_attributes` because
10
+ it would get overwritten if there is a helper method `permitted_attributes` in
11
+ controller
12
+
13
+ ### Build system
14
+
15
+ * Add CHANGELOG.md to gemspec
16
+
17
+ ## 0.0.2
18
+
19
+ ### Bugs fixed
20
+
21
+ * Allow to use non-block syntax for nested form `link_to_add`
22
+ ([5ddc396d5bc03fdef8b4b69b4efcdd0333327ae2](https://github.com/Stellenticket/strong_form/commit/5ddc396d5bc03fdef8b4b69b4efcdd0333327ae2))
23
+
24
+ ## 0.0.1
25
+
26
+ Initial release
@@ -3,17 +3,17 @@ module ActionView
3
3
  module FormHelper
4
4
  alias_method :orig_form_for, :form_for
5
5
 
6
- attr_accessor :permitted_attributes
6
+ attr_accessor :_strong_form_permitted_attributes
7
7
 
8
8
  def form_for(record, options = {}, &block)
9
9
  # explicilty passed
10
10
  if options.key?(:permitted_attributes)
11
- self.permitted_attributes = options.delete(:permitted_attributes)
11
+ self._strong_form_permitted_attributes = options.delete(:permitted_attributes)
12
12
  record.permitted_attributes =
13
- permitted_attributes if record.respond_to?(:permitted_attributes=)
13
+ _strong_form_permitted_attributes if record.respond_to?(:permitted_attributes=)
14
14
  # assigned to object
15
15
  elsif record.respond_to?(:permitted_attributes)
16
- self.permitted_attributes = record.permitted_attributes
16
+ self._strong_form_permitted_attributes = record.permitted_attributes
17
17
  end
18
18
 
19
19
  orig_form_for(record, options, &block)
@@ -46,7 +46,7 @@ module ActionView
46
46
  def fields_for(record_name, record_object = nil, options = {}, &block)
47
47
  assign_child_permitted_attributes!(
48
48
  record_name, record_object, options[:parent_builder].object.permitted_attributes
49
- ) if permitted_attributes && record_object.respond_to?(:permitted_attributes=) && record_object.permitted_attributes.nil?
49
+ ) if _strong_form_permitted_attributes && record_object.respond_to?(:permitted_attributes=) && record_object.permitted_attributes.nil?
50
50
 
51
51
  builder = instantiate_builder(record_name, record_object, options)
52
52
  capture(builder, &block)
@@ -1,3 +1,3 @@
1
1
  module StrongForm
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -1,4 +1,6 @@
1
1
  class BaseController < ApplicationController
2
+ helper_method :permitted_attributes
3
+
2
4
  def basic_form
3
5
  @user = User.new
4
6
  end
@@ -19,4 +21,12 @@ class BaseController < ApplicationController
19
21
  @user = User.new
20
22
  @user.addresses.build
21
23
  end
24
+
25
+ private
26
+
27
+ def permitted_attributes
28
+ {
29
+ bla: :blub
30
+ }
31
+ end
22
32
  end