Forum: Ruby on Rails Error undefined method `of_caller' for Binding:Class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
l00p (Guest)
on 2006-02-07 12:54
Hi all,

I have the following helper method:
        def collapsible_fragment(collapsed, &block)
            html = '<div>'
            html << capture(&block) if( block_given? && !collapsed)
            html << '</div>'
            Binding.of_caller do |binding|
                concat(html, binding)
            end
        end

and within the template this helper is used as follows

&lt;a href="?collapsed=<%=params[:collapsed]=='1' ? '0' :
'1'%&gt;"&gt;collapsed&lt;/a&gt;
&lt;% collapsible_fragment( params[:collapsed]=='1' ) do %&gt;
  Am I visible ?
&lt;%end%&gt;

On production env everything works fine, but when I switch to production
env exception 'undefined method `of_caller' for Binding:Class' is
thrown...

any clue ?

--l00p
l00p (Guest)
on 2006-02-07 12:58
l00p wrote:

> <a href="?collapsed=<%=params[:collapsed]=='1' ? '0' : '1'%>">collapsed</a>
> <% collapsible_fragment( params[:collapsed]=='1' ) do %>
>    Am I visible ?
> <%end%>
>
> On production env everything works fine, but when I switch to production
> env exception 'undefined method `of_caller' for Binding:Class' is
> thrown...
arrgh, sorry on development env everything is fine, when switched to
production exception is thrown
--l00p
This topic is locked and can not be replied to.