sferik/rails_admin — Issue #934: Error caused by wording_for
Author: reinkcar
Created: 2012-01-20 14:36:57+00:00
State: open

I've just upgraded to the recent commit and found the following issues which I believe seem to be caused by the following line in the wording_for helper:

:object_label => model_config && object.try(model_config.object_label_method)

Situation 1:
I haven't defined an own object_label_method for a model and the the model has no attribute called "name". I such situations the above line throws an error.

I've fixed this by defining an object_label_method for each model, but I'd prefer this to be caught in the helper.

Situation 2:
In the _form_filtering_select and _form_filtering_multiselect views,

= link_to wording_for(:link, :new, config.abstract_model) ...

throws an error when the associated_model has not an attribute of the name of the object_label_method of the @object model.

I've fixed this by adding a nil object, but should be in the helper.

= link_to wording_for(:link, :new, config.abstract_model, nil)