From alex at pivotallabs.com Mon Nov 10 21:44:40 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Mon, 10 Nov 2008 18:44:40 -0800 Subject: [Erector-devel] Trouble with partials In-Reply-To: <7a93bd340811101834w1f2051ep61cdf2dde65294fa@mail.gmail.com> References: <7a93bd340811101834w1f2051ep61cdf2dde65294fa@mail.gmail.com> Message-ID: <7a93bd340811101844h22cea1e5s603072c145c9c042@mail.gmail.com> I know Erector's only got partial support for partials (har har) but it seems something has changed, opening up a can of worms. I haven't coded in a few months, and when I dusted off my pet webapp, I was getting a bunch of weird stuff -- hanging, and eventually, huge stack traces. I think I tracked it down to a few problems: (1) I'm using render(:partial,...) and the rails extension to widget.rb didn't have a render_partial method, which led to a NoMethodError being thrown. (2) Rails wraps the NoMethodError in a TemplateError, which contains a pointer to the template, which is the widget object. So when it called to_s on the template aka widget in order to display its name &c for debugging purposes, it kicked off an Erector to_s, which called render, which led to an infinite regress. (3) Ruby doesn't seem to handle infinite regresses very well, and would occassionally swallow the whole stack trace and abort the process without any console output. I'll probably need help unraveling most of the following: * to_s may not really be appropriate as a synonym for render_to_string (or whatever) due to its important role in debugging and system uses. * action_view_template_handler#render seems to have a bug where it picks the wrong class for partials: given "moments/_form" it still instantiates Moments::Edit as its template class. It's picking it up from "view.first_render" rather than "template.path". I've hacked in a fix but I'll need to add tests. * Once we get this widget that we're using as a partial, we need to prime it with all the "assigns" and possibly "locals" from the render :partial call. Anyone have any time to pair on this? I'm feeling very rusty and even more in need of pairing than usual. - A --- Alex Chaffee - alex at stinky.com Stalk me: http://friendfeed.com/alexch | http://twitter.com/alexch | http://alexch.tumblr.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at pivotallabs.com Mon Nov 24 11:50:12 2008 From: mike at pivotallabs.com (Mike Grafton) Date: Mon, 24 Nov 2008 11:50:12 -0500 Subject: [Erector-devel] Rails 2.2 Message-ID: I'm encountering an issue with Rails 2.2 and Erector: /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/renderable.rb:21:in `_unmemoized_compiled_source': undefined method `call' for ActionView::TemplateHandlers::Erector:Class (NoMethodError) from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/memoizable.rb:57:in `compiled_source' from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/memoizable.rb:25:in `__send__' from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/memoizable.rb:25:in `memoize_all' from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/memoizable.rb:22:in `each' from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/memoizable.rb:22:in `memoize_all' from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/memoizable.rb:17:in `freeze' from /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/paths.rb:88:in `reload!' from /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/paths.rb:102:in `templates_in_path' ... 23 levels... from /Library/Ruby/Gems/1.8/gems/rspec-1.1.9/lib/spec/runner/command_line.rb:10:in `run' from /Library/Ruby/Gems/1.8/gems/rspec-1.1.9/bin/spec:4 from /usr/bin/spec:19:in `load' from /usr/bin/spec:19 Myself or somebody on my project is hoping to fix this this week, with help from Brian Takita. But if anybody gets a chance to work on this sooner, please let us know. Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: