Skip to content

Commit

Permalink
Merge 08e44f2 into b92a4d1
Browse files Browse the repository at this point in the history
  • Loading branch information
patleb committed Oct 19, 2016
2 parents b92a4d1 + 08e44f2 commit 7319918
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/rails_admin/abstract_model.rb
Expand Up @@ -20,7 +20,9 @@ def new(m)
m = m.constantize unless m.is_a?(Class)
(am = old_new(m)).model && am.adapter ? am : nil
rescue LoadError, NameError
puts "[RailsAdmin] Could not load model #{m}, assuming model is non existing. (#{$ERROR_INFO})" unless Rails.env.test?
unless Rails.env.test? || m.to_s.try(:start_with?, '#<Class:0x')
puts "[RailsAdmin] Could not load model #{m}, assuming model is non existing. (#{$ERROR_INFO})"
end
nil
end

Expand Down
4 changes: 2 additions & 2 deletions lib/rails_admin/config.rb
Expand Up @@ -223,9 +223,9 @@ def models_pool
def model(entity, &block)
key = begin
if entity.is_a?(RailsAdmin::AbstractModel)
entity.model.try(:name).try :to_sym
entity.model.try(:name).try(:to_sym)
elsif entity.is_a?(Class)
entity.name.to_sym
entity.name.try(:to_sym)
elsif entity.is_a?(String) || entity.is_a?(Symbol)
entity.to_sym
else
Expand Down
8 changes: 5 additions & 3 deletions spec/integration/basic/edit/rails_admin_basic_edit_spec.rb
Expand Up @@ -75,9 +75,11 @@

it 'shows associated objects' do
is_expected.to have_selector '#fan_team_ids' do |select|
expect(select[0]).to have_selector 'option[selected="selected"]'
expect(select[1]).not_to have_selector 'option[selected="selected"]'
expect(select[2]).not_to have_selector 'option[selected="selected"]'
options = select.all 'option'

expect(options[0]['selected']).to eq 'selected'
expect(options[1]['selected']).to eq nil
expect(options[2]['selected']).to eq nil
end
end
end
Expand Down

0 comments on commit 7319918

Please sign in to comment.