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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c0a321b6b65fb2a88e2107426a09cffa67721d7
4
- data.tar.gz: 9f4a594b3282bd55e7cff9a9be5a003d3f3856b5
3
+ metadata.gz: c98dae97d2c1e8798c813adc32c99550ae5f79c3
4
+ data.tar.gz: b56a4bc7a277ec8a9d4de4d41124ce17d8650db1
5
5
  SHA512:
6
- metadata.gz: fc27dae02966d55f49c99c7ceb9fa845cb9cfb165ec55be736d20f301c748dbd11706864007512c007ca07cb4654a61745844e4f18502ba3a624d10d41c02bbc
7
- data.tar.gz: 53b50812f0d5075b8ae1198763fb02b1e098fe3ebe4392353ffa624bc0148844209eef73d04bd760c9c6e202fbb1c5e39ecb9eb1924407b486cbbfb818e3c9d0
6
+ metadata.gz: b07c4a4b37f46623091992bf88a78698f214e6ab9ae4c659944c5c12bf60a9027b4b19121764337e90e421354436820a0416aae6fac67fdbca0bd33cb9c5ec7e
7
+ data.tar.gz: 86e6ba702f3ad70f0c36b2ed446c4491bc4bf727957d999d8fe0d1835474897a1c23987575524dd7da44d75f51c6999605032fa8b9330cc2e2f8cc667e2dbe18
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  log/*.log
3
3
  Gemfile.lock
4
4
  pkg/
5
+ coverage/
5
6
  spec/dummy/db/*.sqlite3
6
7
  spec/dummy/db/*.sqlite3-journal
7
8
  spec/dummy/log/*.log
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ 0.0.6 6/14/2016
2
+ ==============
3
+
4
+ ### Bug Fixes
5
+
6
+ Polymorphic associations were not properly using the "xxx_assigns" attribute name
7
+ in the form.
8
+
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source "https://rubygems.org"
3
3
 
4
4
  gemspec
5
5
  gem 'activeadmin', github: 'activeadmin'
6
+ gem 'coveralls', require: false
@@ -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+include_virtual_attributes
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
- }+include_virtual_attributes
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,
@@ -1,3 +1,3 @@
1
1
  module IntrospectiveAdmin
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/spec/rails_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
- ENV["RAILS_ENV"] ||= 'test'
1
+ require 'coveralls'
2
+ Coveralls.wear!('rails')
3
+ ENV["RAILS_ENV"] = 'test'
2
4
  require File.expand_path("../dummy/config/environment", __FILE__)
3
5
  require 'rspec/rails'
4
6
  Dir[Rails.root.join("../support/**/*.rb")].each { |f| require f }
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.5
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-04-21 00:00:00.000000000 Z
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.2.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.