Ticket #733 (defect)
Opened 3 months ago
Last modified 2 months ago
ActionView::TemplateError (undefined method `[]' for #<Enumerable::Enumerator:0x...>)
Status: closed (worksforme)
| Reported by: | crea@des.glaubst.net | Assigned to: | lrbalt |
|---|---|---|---|
| Priority: | high | Milestone: | 1.7 |
| Component: | Coding | Version: | trunk |
| Severity: | major | Keywords: | |
| Cc: |
since the last changes on the todo rendering stuff, I always get this error on different locations, depending on the view I want to render. Uses the whole thing unusable, except the mobile view (where there is no javascript toggle stuff or such things). Currently I'm on rev876. If you need more log output, feel free to ask.
Attachments
Change History
06/12/08 13:42:37: Modified by guest
- attachment production_log.txt added.
06/12/08 13:43:55: Modified by crea@des.glaubst.net
06/12/08 14:42:04: Modified by lrbalt
- owner changed from bsag to lrbalt.
- status changed from new to assigned.
do you mean that revision 876 introduced there errors for you?
06/12/08 14:42:18: Modified by lrbalt
- milestone set to 1.7.
06/12/08 14:50:47: Modified by crea@des.glaubst.net
sorry that I did not mention this. My last svn update (I think it was somewhat around 860, just before the 1.6 branch) had this bug also, but I only noticed it today (yesterday everything worked ok). To be sure that there is the latest revision in place (because I read something on the todo stuff that was fixed), I updated today to 876, but the error still occurs.
I played around a little and commented out some lines of code that did some ujs style stuff (like the element.next('.todo_notes').blah), and got the Todo view working (except the ability to toggle visibilty of notes, what a surprise ;)). I then looked on the elements with the .todo_notes class, but they seemed to be ok.
Maybe it is also linked to a browser or a bad data from database problem, I did not find out exactly, which note was responsible for this problem.
06/12/08 15:09:19: Modified by lrbalt
what happened between yesterday and today that triggered this error? Was it after a new todo? From the log it looks like you hit the error on the first or second todo. Does it have specific html in the notes or something?
06/12/08 15:54:18: Modified by crea@des.glaubst.net
I looked at it, the first two todos contain no note, the third one does, but without special characters or html, just simple text. The only thing I did yesterday was adding one more todo, but afterwards, the view rendered nicely, so I don't know what happened today. I also don't think that another user (there are several users using this tracks installation) brought up this problem to my view. Anything I can do for better problem solving?
06/13/08 05:55:32: Modified by crea@des.glaubst.net
Another few things I noticed in the meantime: browser-independent (tested on IE, Firefox and Safari), what was nearly obvious, because the error came from the server side. And, I checked with my friend who is also using this installation, the error happens with his tasks too, so I assume the data from the db is correct. Looks like the element.next() method returns an array instead of a DOM element?
06/13/08 07:01:34: Modified by lrbalt
very strange. I cannot reproduce it which makes it difficult for me to find the cause.
could you try this (its a long shot though)
replace element with elem twice in _toggle_notes.rhtml, like
<% apply_behavior 'a.show_notes:click', :prevent_default => true do |page, elem|
elem.next('.todo_notes').toggle
end -%>
06/13/08 07:09:41: Modified by crea@des.glaubst.net
unfortunately this did not work. I could comment out the relevant lines of code (so that the page can be rendered) and upload the html, if you want to.
06/13/08 07:14:09: Modified by lrbalt
that would be great. I'd like to scan it. You can also send it by email if you prefer not to have your todos on the trac website. Its lrbalt@gmail.com
06/13/08 07:22:05: Modified by crea@des.glaubst.net
ok, sent you an email with the rendered HTML. I had to comment out two things:
line 3 from app/views/todos/_toggle_notes.rhtml
and line 40 from app/views/layouts/standard.html.erb, from the following error:
ActionView::TemplateError (undefined method `[]' for #<Enumerable::Enumerator:0xb6fa6da4>) on line #40 of layouts/standard.html.erb:
37: </div>
38: <div id="minilinks">
39: <%= link_to_function("Toggle notes", nil, {:accesskey => "S", :title => "Toggle all notes", :id => "toggle-notes-nav"}) do |page|
40: page.select('body .todo_notes').each { |e| e.toggle }
41: end
42: -%> |
43: <%= link_to "Logout (#{current_user.display_name}) »", logout_path %>
06/13/08 08:10:02: Modified by lrbalt
- severity changed from blocker to major.
I've compared your html with my own. I cannot see any differences.
Since you also had to disable
40: page.select('body .todo_notes').each { |e| e.toggle }
It seems that for you the DOM finders are not functioning. This is part of the prototype library / prototype helpers, i.e. part of rails.
This part of the code does nothing with your database, so that's probably not the cause.
Since you are the only reporter and you have the problem from around r860, I think its specific to your install.
It could be that your rails install is broken. You could consider installing Tracks again in a separate directory, point it to the same db as your production and /recreate/ environment.rb (only fill in the salt). Start tracks from this install (shutdown your 'normal' tracks instance first) and see if the error happens here too.
If the error remains, you could try to start tracks with -e development Hopefully this will cause rails to put more information in the log when an error occurs.
06/13/08 08:31:20: Modified by crea@des.glaubst.net
- severity changed from major to blocker.
Because you mentioned the rails installation: I upgraded my system-wide rails to 2.1.0 (via gem update) - could this be the root cause? Nevertheless I thought that rails is included in the vendor directory, so this shouldn't be affected.
06/13/08 08:33:40: Modified by crea@des.glaubst.net
- severity changed from blocker to major.
06/13/08 08:52:07: Modified by lrbalt
your right that rails is in the vendor directory, so your upgrade should not affect tracks.
06/13/08 09:14:33: Modified by crea@des.glaubst.net
I checked out last r879 from trunk and installed in a new directory. Error remains the same in production mode, and when starting with development environment, no more useful additional output is left in the log, but I'll attach it though.
06/13/08 09:15:00: Modified by crea@des.glaubst.net
- attachment development_log.txt added.
06/13/08 09:28:23: Modified by lrbalt
I'm a out of options :-( I've asked on the mailing list if anybody has seen this error before.
06/13/08 09:51:32: Modified by crea@des.glaubst.net
Okay. In the meantime, I'll investigate further into this on the weekend, maybe I find something.
07/11/08 15:50:55: Modified by lrbalt
any luck?
07/11/08 17:24:10: Modified by crea@des.glaubst.net
- status changed from assigned to closed.
- resolution set to worksforme.
Hi,
I'm glad that you asked. I tried today reinstalling from scratch (via git) and used the environment.rb.tmpl with only changing environment to production and salt, and, surprise surprise, no error any more.
Whatever was changed in the meantime, it made it working for me now. I had not enough time to make deeper tests - but now I'm able to test the mobile view on my new iphone ;)
07/11/08 21:25:17: Modified by lrbalt
great to hear. Enjoy!

Add-On: I attached the log output from the startup view (the screen directly after the login screen).