introspective_admin 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -0
- data/lib/introspective_admin/base.rb +7 -7
- data/lib/introspective_admin/version.rb +1 -1
- data/spec/rails_helper.rb +3 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98dae97d2c1e8798c813adc32c99550ae5f79c3
|
4
|
+
data.tar.gz: b56a4bc7a277ec8a9d4de4d41124ce17d8650db1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07c4a4b37f46623091992bf88a78698f214e6ab9ae4c659944c5c12bf60a9027b4b19121764337e90e421354436820a0416aae6fac67fdbca0bd33cb9c5ec7e
|
7
|
+
data.tar.gz: 86e6ba702f3ad70f0c36b2ed446c4491bc4bf727957d999d8fe0d1835474897a1c23987575524dd7da44d75f51c6999605032fa8b9330cc2e2f8cc667e2dbe18
|
data/.coveralls.yml
ADDED
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -32,17 +32,17 @@ module IntrospectiveAdmin
|
|
32
32
|
(model.reflections[column.sub(/_id$/,'')].try(:options)||{})[:polymorphic]
|
33
33
|
end
|
34
34
|
|
35
|
-
def column_list(model)
|
35
|
+
def column_list(model, extras=[])
|
36
36
|
model.columns.map {|c|
|
37
37
|
ref_name = c.name.sub(/(_type|_id)$/,'')
|
38
38
|
model.reflections[ref_name] ? ref_name : c.name
|
39
|
-
}.uniq-['created_at','updated_at']-exclude_params+
|
39
|
+
}.uniq-['created_at','updated_at']-exclude_params+extras
|
40
40
|
end
|
41
41
|
|
42
|
-
def params_list(model)
|
42
|
+
def params_list(model, extras=[])
|
43
43
|
model.columns.map {|c|
|
44
44
|
polymorphic?(model,c.name) ? c.name.sub(/_id$/,'')+"_assign" : c.name
|
45
|
-
}+
|
45
|
+
}+extras
|
46
46
|
end
|
47
47
|
|
48
48
|
def link_record(record)
|
@@ -132,14 +132,14 @@ module IntrospectiveAdmin
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
permit_params klass.params_list(model) + [Hash[nested_config.map{|assoc,o|
|
135
|
+
permit_params klass.params_list(model, klass.include_virtual_attributes) + [Hash[nested_config.map{|assoc,o|
|
136
136
|
["#{assoc}_attributes", o[:params]+[(o[:allow_destroy] ? :_destroy : '')] ]
|
137
137
|
}]]
|
138
138
|
|
139
139
|
form do |f|
|
140
140
|
f.actions
|
141
141
|
|
142
|
-
klass.column_list(model).each do |column|
|
142
|
+
klass.column_list(model, klass.include_virtual_attributes).each do |column|
|
143
143
|
if column == model.primary_key
|
144
144
|
elsif klass.polymorphic?(model,column)
|
145
145
|
f.input column+"_assign", collection: model.send("#{column}_assign_options")
|
@@ -161,7 +161,7 @@ module IntrospectiveAdmin
|
|
161
161
|
if c == model_name || c == options[:polymorphic_reference]
|
162
162
|
# the join to the parent is implicit
|
163
163
|
elsif klass.polymorphic?(aclass,c)
|
164
|
-
r.input c, collection: aclass.send("#{c}_assign_options")
|
164
|
+
r.input "#{c}_assign", collection: aclass.send("#{c}_assign_options")
|
165
165
|
elsif aclass.reflections[c] && aclass.respond_to?("options_for_#{c}")
|
166
166
|
# If the class has an options_for_<column> method defined use that
|
167
167
|
# rather than the default behavior, pass the instance for scoping,
|
data/spec/rails_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: introspective_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass-rails
|
@@ -129,8 +129,10 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".coveralls.yml"
|
132
133
|
- ".gitignore"
|
133
134
|
- ".travis.yml"
|
135
|
+
- CHANGELOG.md
|
134
136
|
- Gemfile
|
135
137
|
- Gemfile.lock
|
136
138
|
- LICENSE
|
@@ -266,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
268
|
version: '0'
|
267
269
|
requirements: []
|
268
270
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.4.5
|
270
272
|
signing_key:
|
271
273
|
specification_version: 4
|
272
274
|
summary: Set up basic ActiveAdmin screens for an ActiveRecord model.
|