dynamic_scaffold 0.1.1 → 0.1.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
- SHA1:
3
- metadata.gz: 0c64686f0fc95517b0901452b8e4934e9b524c16
4
- data.tar.gz: cc57d350c41ae55ef1523f0e16fdf5cc11092faa
2
+ SHA256:
3
+ metadata.gz: d2c69599532720391f335e6ae0d030b098a22eed1a2fa48deedf68b5b3ced706
4
+ data.tar.gz: 18404194c7478ac7a52c8c3a0e02cb91b69c01fa65d5fe58504c76834265979b
5
5
  SHA512:
6
- metadata.gz: 6e09ee302e386f91161bce9faf086eceb20e1fde259967b09132dce4c942669e01bad245e40a8d28de037299b374c9f7af005b1f614b70db8e06aadc93a27034
7
- data.tar.gz: e216eb328a7afb108c39e2ac0d0d4e2d399077162f7843ab21b219193da5e05437935fbad149f73bcacd88e2e609dc11dbf97396b20d77127f932cf553f3241f
6
+ metadata.gz: 913554132733f067c123e7b5393bd49fee5e8560852c7c4d1dbaff80673447afc12e297138ee9a191260c40f281f15d538c46ea00f19deac2c2f9c8319b4560d
7
+ data.tar.gz: cafd49f13fae940b025633068414bdce3a103549f1ab2ed57726d00a8dab65a5df95f0a0060123eb8a440953e7e19622d3f6401ad2ad5421b23964fbff172e1e
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
17
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
20
  load 'rails/tasks/statistics.rake'
@@ -73,7 +73,7 @@ module DynamicScaffold
73
73
 
74
74
  def update
75
75
  values = update_values
76
- @record = find_record(extract_pkeys(values))
76
+ @record = find_record(dynamic_scaffold.model.primary_key => params['id'])
77
77
  prev_attribute = @record.attributes
78
78
  @record.attributes = values
79
79
  dynamic_scaffold.model.transaction do
@@ -8,11 +8,6 @@ module DynamicScaffold
8
8
  dynamic_scaffold.scope.each_with_object({}) {|attr, res| res[attr] = params[attr] }
9
9
  end
10
10
 
11
- # Get the primary key hash from the update parameters.
12
- def extract_pkeys(values)
13
- [*dynamic_scaffold.model.primary_key].each_with_object({}) {|col, res| res[col] = values[col] }
14
- end
15
-
16
11
  # Convert pkey_string value to hash.
17
12
  def pkey_string_to_hash(pkey)
18
13
  # https://github.com/gomo/dynamic_scaffold/pull/9/commits/ff5de0e38b3544347e82539c45ffd2efaf3410da
@@ -1,3 +1,3 @@
1
1
  module DynamicScaffold
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  class DynamicScaffoldGenerator < Rails::Generators::Base
2
- source_root File.expand_path('../templates', __FILE__)
2
+ source_root File.expand_path('templates', __dir__)
3
3
 
4
4
  argument :path, type: 'string', required: true
5
5
  argument :model, type: 'string', required: false
@@ -58,7 +58,7 @@ class <%= @class_scope.present? ? "#{@class_scope}::" : '' %><%= @plural_model_n
58
58
 
59
59
  # You can customize the form fields through `config.form`.
60
60
  # Please see https://github.com/gomo/dynamic_scaffold#customize-form for details.
61
- <%- @model.column_names.each do |column| -%>
61
+ <%- @model.column_names.select{|c| c != @model.primary_key}.each do |column| -%>
62
62
  config.form.item(:text_field, :<%= column %>)
63
63
  <%- end -%>
64
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masamoto Miyata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-09 00:00:00.000000000 Z
11
+ date: 2018-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: classnames-rails-view
@@ -348,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
348
348
  version: '0'
349
349
  requirements: []
350
350
  rubyforge_project:
351
- rubygems_version: 2.6.14
351
+ rubygems_version: 2.7.6
352
352
  signing_key:
353
353
  specification_version: 4
354
354
  summary: The Scaffold system which dynamically generates CRUD and sort functions.