-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
table_for with no items displays "[]" #1016
Comments
The associated html is:
|
I hacked out the offending stray text using jQuery:
|
What version of active admin are you using? I can't seem to replicate it on master. |
For what it's worth, I'm experiencing this same issue on 0.3.4: http://cl.ly/1G151a2W2B1m3W0W0v0h |
I'm using 0.4.0. On Tue, Feb 14, 2012 at 5:18 PM, Greg Bell
|
I tried setting my Gemfile to point to the github version of activeadmin. This didn't solve the problem. Can you point me to the code that I should examine more closely? I don't mind digging in, but a few pointers would help. |
@djwonk I tried looking into this a bit and couldn't figure it out on first walkthrough. The code in question can be found here https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/components/table_for.rb You also might want to look in the arbre directory as that's where the HTML is mainly generated (https://github.com/gregbell/active_admin/tree/master/lib/active_admin/arbre) My suspicion is that it has to do with default return values from some of the functions as otherwise why would a blank array show up? As an initial idea, perhaps the call to I've had this problem on 0.3.4 and 0.4.0. |
This happens on ruby 1.9 only because [].to_s returns "[]" on 1.9. |
This is fixed in master. Slated for 0.4.2. |
Thanks for fixing this! I just want to mention that the behavior difference isn't just for []. It applies to all arrays. In Ruby 1.8.7:
In Ruby 1.9.3:
Hopefully the code takes this into account. |
Change only affects empty arrays. Arrays should work the same as they always have. |
Closed by 2d70197 |
In a show page for one object, where a table_for is used to display associated items, it displays "[]" instead of just making an empty table.
Source code example, in my
cases.rb
file:The text was updated successfully, but these errors were encountered: