Permalink
Browse files

Mongoid non-persisted objects have an id.

  • Loading branch information...
1 parent 861f4de commit 67a611df0c16ad854d48d0cf648af345b33cc9ee @bbenezech bbenezech committed Oct 2, 2012
View
2 app/views/rails_admin/main/_form_filtering_multiselect.html.haml
@@ -43,5 +43,5 @@
= form.select field.method_name, collection, { :selected => selected_ids, :object => form.object }, field.html_attributes.reverse_merge({:data => { :filteringmultiselect => true, :options => js_data.to_json }, :multiple => true})
- if authorized? :new, config.abstract_model
- path_hash = { :model_name => config.abstract_model.to_param, :modal => true }
- - path_hash.merge!({ :associations => { field.inverse_of => (form.object.id || 'new') } }) if field.inverse_of
+ - path_hash.merge!({ :associations => { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
= link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', :data => { :link => new_path(path_hash) }, :class => "create btn btn-info", :style => 'margin-left:10px'
View
2 app/views/rails_admin/main/_form_filtering_select.html.haml
@@ -30,7 +30,7 @@
- if authorized? :new, config.abstract_model
- path_hash = { :model_name => config.abstract_model.to_param, :modal => true }
- - path_hash.merge!({ :associations => { field.inverse_of => (form.object.id || 'new') } }) if field.inverse_of
+ - path_hash.merge!({ :associations => { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
= link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', :data => { :link => new_path(path_hash) }, :class => "btn btn-info create", :style => 'float:left; margin-left:10px'
- if edit_url.present?

0 comments on commit 67a611d

Please sign in to comment.