record_collection 0.4.1 → 0.4.2

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: 27a961f9360e4b6b15247645a561d95d9175ffd2
4
- data.tar.gz: b759cd45c821a2cdb7883c12571409c893a81356
3
+ metadata.gz: 629abcbda806a965d21f0c56102758f4dd155710
4
+ data.tar.gz: 52708e350c3ece73f4c847446ed4333da7552798
5
5
  SHA512:
6
- metadata.gz: 19531f61ada3020a7623c0636c6a65e1f88190690ec7da23aa2035d79edd80ea60c5a829fa2999232c042f84e3068787cc78ad583a6fbb010943178a6505c3a0
7
- data.tar.gz: 4b8f4546f36ab1e8e934b895904b5540ca689ed97a464cd80589824b80780bf68a3436dc3d2adfc45f5adfcd85736ff38e72354d9a1134ec758884d03982795d
6
+ metadata.gz: ada1f8d479a7755526e369ed0eeb83a18f8b0aa30e16f40a2ae89abd22cba7af46b796279bcb4c19722e7dcaffe8a5aefdd845a602b22b7330fc9c42e9a7c0da
7
+ data.tar.gz: d51b151b2baf52a4b6849e3f1c4cbe75563ee047135e0bfc0452710106f1897079bc52f3bc537b1436ed6ba2bf5c035d378ba9235adfc3017579c1884f0adc0e
data/README.md CHANGED
@@ -126,7 +126,7 @@ the standard [form_helpers](http://guides.rubyonrails.org/form_helpers.html)<br>
126
126
  The form you create typically looks like [app/views/employees/collection_edit.html.slim](spec/dummy/app/views/employees/collection_edit.html.slim):
127
127
  ```slim
128
128
  h1 Edit multiple employees
129
- = form_for @collection, url: [:collection_update, @collection.record_class] do |f|
129
+ = form_for @collection, url: [:collection_update, @collection] do |f|
130
130
  = f.collection_ids
131
131
  .form-inputs= f.optional_text_field :section
132
132
  .form-inputs= f.optional_boolean :admin
@@ -147,8 +147,11 @@ standard way of selecting records from the index page. To filter records
147
147
  to a specific subset the [ransack](https://github.com/activerecord-hackery/ransack)
148
148
  gem also provides a nice way to add filtering to the index page. To add
149
149
  checkbox selecting to your page this gem assumes the following
150
- structure using the [Slim lang](http://slim-lang.com/):
150
+ structure using the [Slim lang](http://slim-lang.com/)
151
+
152
+ [app/views/employees/index.html.slim](spec/dummy/app/views/employees/index.html.slim)
151
153
  ```slim
154
+ h1 Listing Employees
152
155
  table.with-selection
153
156
  thead
154
157
  tr
@@ -65,16 +65,10 @@ module RecordCollection
65
65
  end
66
66
 
67
67
  def persisted?
68
- # Behave like an update in forms
69
- true
70
- end
71
-
72
- def new_record?
73
- # Behave like an update in forms
68
+ # Behave like an update in forms, this triggers plural routes
74
69
  false
75
70
  end
76
71
 
77
-
78
72
  # This method returns nil when the values of `attr` in the collection
79
73
  # are mixed. Otherwise the value itself. For boolean attributes the
80
74
  # check is wether the values are truthy or falsy. If the
@@ -3,5 +3,13 @@ module RecordCollection
3
3
  def param_key
4
4
  'collection'
5
5
  end
6
+
7
+ def singular_route_key
8
+ @klass.record_class.model_name.singular_route_key
9
+ end
10
+
11
+ def route_key
12
+ @klass.record_class.model_name.route_key
13
+ end
6
14
  end
7
15
  end
@@ -1,3 +1,3 @@
1
1
  module RecordCollection
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  h1 Edit multiple employees
2
- = form_for @collection, url: [:collection_update, @collection.record_class] do |f|
2
+ = form_for @collection, url: [:collection_update, @collection] do |f|
3
3
  = render 'form_errors', target: @collection
4
4
  .form-inputs= f.optional_text_field :section
5
5
  .form-inputs= f.optional_boolean :admin
@@ -1,6 +1,5 @@
1
1
 
2
2
  h1 Listing Employees
3
-
4
3
  table.with-selection
5
4
  thead
6
5
  tr
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: record_collection
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
  - Benjamin ter Kuile