ridgepoler-rails 1.0.0 → 1.0.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f2caa65b8da67f8b3abb67838eb8f037b76ecf0
|
4
|
+
data.tar.gz: dd9dd18a521dedaac21baf596359122139bb07e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50311369a7f00a02a74502f48869edd57656b9131a2e0ce7c9255784128d0188a2b79d3a6e47f2d50684eee7dff258287775e49efe2e21884493781fe089a32c
|
7
|
+
data.tar.gz: 952e52a7af6f096f6844ff24b7d06ee2e1730bbc4aac09108998987678daaa8974aac73e70e15143e89b92af9ade93c814c155f5f5b6db978240015ad8b48f13
|
@@ -5,6 +5,8 @@ require 'rails/generators/active_record/model/model_generator'
|
|
5
5
|
module Rails
|
6
6
|
module Generators
|
7
7
|
class RidgepoleGenerator < ActiveRecord::Generators::ModelGenerator
|
8
|
+
IGNORE_ATTRIBUTE_OPTIONS = %i[foreign_key]
|
9
|
+
|
8
10
|
def self.source_paths
|
9
11
|
[ActiveRecord::Generators::ModelGenerator.source_root, File.expand_path('../templates', __FILE__)]
|
10
12
|
end
|
@@ -15,6 +17,17 @@ module Rails
|
|
15
17
|
|
16
18
|
template 'schema.rb', File.join('db/schema', class_path, "#{file_name}.rb")
|
17
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def options_for_attribute(attribute)
|
24
|
+
opts = attribute.options_for_migration.
|
25
|
+
except(*IGNORE_ATTRIBUTE_OPTIONS).
|
26
|
+
map { |k, v| "#{k}: #{v.inspect}" }.
|
27
|
+
join(', ')
|
28
|
+
|
29
|
+
opts.present? ? ", #{opts}" : ""
|
30
|
+
end
|
18
31
|
end
|
19
32
|
end
|
20
33
|
end
|
@@ -7,7 +7,7 @@ create_table :<%= table_name %><%= primary_key_type %>, force: :cascade do |t|
|
|
7
7
|
<% elsif attribute.token? -%>
|
8
8
|
t.string :<%= attribute.name %><%= attribute.inject_options %>
|
9
9
|
<% else -%>
|
10
|
-
t.<%= attribute.type %> :<%= attribute.name %><%= attribute
|
10
|
+
t.<%= attribute.type %> :<%= attribute.name %><%= options_for_attribute(attribute) %>
|
11
11
|
<% end -%>
|
12
12
|
<% end -%>
|
13
13
|
<% if options[:timestamps] %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepoler-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.6.
|
107
|
+
rubygems_version: 2.6.13
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Provides integration between ridgepole and rails 5 newer
|