Thanks for the help. The fix fixed the render :super for the first
layer "list.html.erb". It still has the error in 1.9 for me. You
changed prefix to [prefix]. This makes args_for_lookup return prefix
as an array when resolver.find_all is looking for a string. I just
took the results of args_for_lookup and changed prefix to the first
element returned in the prefix array. I know it's kind of hacky but
it works.
class LookupContext
module ViewPaths
def find_all_templates(name, partial = false, locals = {})
prefixes.collect do |prefix|
view_paths.collect do |resolver|
temp_args = *args_for_lookup(name, [prefix], partial,
locals )
temp_args[1] = temp_args[1][0]
resolver.find_all(*temp_args)
end
end.flatten!
end
end
end
On Sep 28, 8:56 am, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> On Viernes, 23 de Septiembre de 2011 22:27:05 blmundie escribió:
>
> > Best I can tell there are two issue. The first is
> > args_for_lookup(name, prefixes, partial, keys) calls .map on prefixes
> > and activescaffold is passing a single prefix as a string. Map is not
> > a documented method for String. It works on String on my 1.8.7
> > install but not 1.9+. To fix this I changed find_all_templates in
> > active scaffold to. This sends prefix as an array and gets the string
> > out from the return. I'm not sure this is the ideal solution, but it
> > works.
>
> Thanks, I missed this one becuase I use 1.8.7, although I'm not sure why it
> worked.
>
>
>
>
>
>
>
>
>
>
>
> > class LookupContext
> > module ViewPaths
> > def find_all_templates(name, partial = false, locals = {})
> > prefixes.collect do |prefix|
> > view_paths.collect do |resolver|
> > temp_args = *args_for_lookup(name, [prefix], partial,
> > locals )
> > temp_args[1] = temp_args[1][0]
> > resolver.find_all(*temp_args)
> > end
> > end.flatten!
> > end
> > end
> > end
>
> > The second issue I've run into is that @_view_stack is nil if I call
> > render :super in the first view and not the partial. Seems like the
> > stack only gets added to from render called in the view. Therefor I
> > get an error when I call render :super in list.html.erb, but not if I
> > call it in _list.html.erb.
>
> I have fixed it. I dislike this fix because it uses a internal variable, which
> could be removed in a later version, but render :super it's really a hack too,
> so another hack more is not very important.
>
>
>
>
>
>
>
>
>
>
>
> > On Sep 22, 7:25 pm, blmundie <[email protected]> wrote:
> > > This only happens when i use render :super in list.html.erb. Does
> > > anyone have an idea?
>
> > > On Sep 21, 6:57 pm, blmundie <[email protected]> wrote:
> > > > If i set the template to render a partial that render :super I get
> > > > past the above error. It then gives me a new error. I get is
> > > > ActionView::Template::Error (undefined method `map' for
> > > > "installations":String):
> > > > 18: ")%>
> > > > 19:
> > > > 20:
> > > > 21: <%= render :super %>
> > > > actionpack (3.1.0) lib/action_view/lookup_context.rb:129:in
> > > > `normalize_name'
> > > > actionpack (3.1.0) lib/action_view/lookup_context.rb:114:in
> > > > `args_for_lookup'
> > > > /home/bryan/.rvm/gems/ruby-head/bundler/gems/
> > > > active_scaffold-5c4ae3b25238/lib/active_scaffold/extensions/
> > > > action_view_rendering.rb:7:in `block (2 levels) in find_all_templates'
>
> > > > installations is the name of my model.
>
> > > > On Sep 21, 4:15 pm, blmundie <[email protected]> wrote:
> > > > > I'm getting an error when calling render :super in rails 3.1.
>
> > > > > ActionView::Template::Error (You have a nil object when you didn't
> > > > > expect it!
> > > > > You might have expected an instance of Array.
> > > > > The error occurred while evaluating nil.last):
> > > > > 19:
> > > > > 20:
> > > > > 21:
> > > > > 22: <%= render :super %>
> > > > > /home/bryan/.rvm/gems/ruby-head/bundler/gems/
> > > > > active_scaffold-0ce03559d49f/lib/active_scaffold/extensions/
> > > > > action_view_rendering.rb:42:in `render_with_active_scaffold'
> > > > > app/views/installation_alarms/list.html.erb:22:in
> > > > > `_app_views_installation_alarms_list_html_erb__1059381062_93896420'
>
> > > > > seems like activescaffold is looking for @_view_stack which is
> > > > > nil.https://github.com/activescaffold/active_scaffold/blob/master/li
> > > > > b/act... line 42
>
> --
> Sergio Cambra .:: entreCables S.L. ::.
> Mariana Pineda 23, 50.018 Zaragoza
> T) 902 021 404 F) 976 52 98 07 E) [email protected]
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.