You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hide the field "% Done" (field_done_ratio) with your plugin
In a project's Issues tab, display a saved query showing that field
-> Error 500
In the log :
ActionView::Template::Error (undefined method round' for "":String): app/helpers/application_helper.rb:1121:incollect'
app/helpers/application_helper.rb:1121:in progress_bar' app/helpers/queries_helper.rb:148:incolumn_value'
This is due to query_column_patch.rb which returns "" (empty string) whatever field is hidden.
It would be more appropriate to test the field value type and return something appropriate.
For example,
def value_with_hidden(object)
val = object.send name
if object.respond_to?(:hidden_attribute_names)
hidden_fields = object.hidden_attribute_names.map {|field| field.sub(/_id$/, '')}
if hidden_fields.include?(name.to_s)
case val
when Fixnum
0
when Array
[]
else
""
end
fixes this problem (although maybe some more cases should be defined, I haven't gone through all possibilities).
The text was updated successfully, but these errors were encountered:
-> Error 500
In the log :
ActionView::Template::Error (undefined method
round' for "":String): app/helpers/application_helper.rb:1121:in
collect'app/helpers/application_helper.rb:1121:in
progress_bar' app/helpers/queries_helper.rb:148:in
column_value'This is due to query_column_patch.rb which returns "" (empty string) whatever field is hidden.
It would be more appropriate to test the field value type and return something appropriate.
For example,
def value_with_hidden(object)
val = object.send name
if object.respond_to?(:hidden_attribute_names)
hidden_fields = object.hidden_attribute_names.map {|field| field.sub(/_id$/, '')}
if hidden_fields.include?(name.to_s)
case val
when Fixnum
0
when Array
[]
else
""
end
fixes this problem (although maybe some more cases should be defined, I haven't gone through all possibilities).
The text was updated successfully, but these errors were encountered: