strong_form 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6626016366a5ba97f7bcaa7fac2477926c1a7375
4
- data.tar.gz: 5fcc3a6cbbcb4cd8a1c935fb2c7f1a501d6442b9
3
+ metadata.gz: a30f0f44d553fb9d707018abd5d9d55aa03ec1dd
4
+ data.tar.gz: b8ce403abbfdf3a12aeb68872b3ef7773db66ec5
5
5
  SHA512:
6
- metadata.gz: ba49e910f1db4bae7ca1a0441e6c39aad3e4d7829419a3f489000ed8e70d588cf09f624a7d91140d1000f26db89937c3fd91dd94068e0f8c9682edcdaf931c07
7
- data.tar.gz: ac81fb50f77cf8c4cd05d28e17dd305908e89411cd4ba2a60a615a0aa4fe9b0b63d51c8d8ab6e746bb3cff7aa59075b9aa6d8fe2399ccfe2e7fcb7e30ef45d31
6
+ metadata.gz: 8a2a3ec614c3b8e1aef6703421a7ae931e2180d922db010318a12c5e494a754bf8b8b76baea275d15b95825651271105b63a0d45ab5bddb7c0165910064d755a
7
+ data.tar.gz: b5a489bc2673f013f1d93aa63872c473e26ddc912c5286f2bc1cf289a8e4c6b367297e1d9d6844c82c0488185356d8fc0b04368ca46a6c9ef22a61f57083846d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.0.6
6
+
7
+ ### Bugs fixed
8
+
9
+ * Permit array attributes with `[roles: []]`, too, not only with `[:roles]`.
10
+ In fact it is OK to have either the symbol or a hash with the key (value is
11
+ ignored). Makes this more compatible with Rail`s strong params.
12
+
5
13
  ## 0.0.5
6
14
 
7
15
  ### Bugs fixed
@@ -8,7 +8,10 @@ module StrongForm
8
8
  if object.respond_to?(:permitted_attributes) && !object.permitted_attributes.nil?
9
9
  (@html_options || @options)[:disabled] ||=
10
10
  object.permitted_attributes != true &&
11
- !object.permitted_attributes.include?(@method_name.to_sym)
11
+ (
12
+ !object.permitted_attributes.include?(@method_name.to_sym) &&
13
+ !object.permitted_attributes.include?("#{@method_name}": [])
14
+ )
12
15
  end
13
16
  render_orig
14
17
  end
@@ -1,3 +1,3 @@
1
1
  module StrongForm
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -2,3 +2,4 @@
2
2
  = f.text_field :last_name
3
3
  = f.select :gender, %i(m f)
4
4
  = f.text_area :description
5
+ = f.select :roles, %i(admin user banned), multiple: true
Binary file
@@ -0,0 +1,5 @@
1
+ class AddRolesToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :roles, :string
4
+ end
5
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150626132542) do
14
+ ActiveRecord::Schema.define(version: 20151116150723) do
15
15
 
16
16
  create_table "addresses", force: :cascade do |t|
17
17
  t.string "street"
@@ -39,6 +39,7 @@ ActiveRecord::Schema.define(version: 20150626132542) do
39
39
  t.text "description"
40
40
  t.datetime "created_at", null: false
41
41
  t.datetime "updated_at", null: false
42
+ t.string "roles"
42
43
  end
43
44
 
44
45
  end
Binary file
@@ -53,3 +53,10 @@ Migrating to CreateTags (20150626132542)
53
53
  SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150626132542"]]
54
54
   (2.4ms) commit transaction
55
55
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
56
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
57
+ Migrating to AddRolesToUsers (20151116150723)
58
+  (0.1ms) begin transaction
59
+  (0.3ms) ALTER TABLE "users" ADD "roles" varchar
60
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151116150723"]]
61
+  (0.4ms) commit transaction
62
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"