Hi folks,

in a front controller I have an index action which aims to be some sort of 
dash board.
As context is not properly set here for the Ajax update="part" mechanism, I 
built my own simple solution:

In the view I display a partial:

> <div id="recent"><partial name="recent_conversations" /></div>


...which I update using javascript to trigger the action refresh:

> jQuery.ajax({
>   url: "sales/refresh",
>   type: "POST",
>   success: function(result){
>     jQuery("#recent").html(result);
>   },
> });


The action refresh rerenders the partial...

> def refresh
>   render partial: "recent_conversations"
> end 


which looks like this.

> <collection with="&Conversation.recent(5)"/> 


That updating indeed works .... until I refresh in the browser:

> NoMethodError - undefined method 
> `_app_views_sales_front__recent_conversations_dryml___4446832432458842744_85050360'
>  
> for #<#<Class:0x0000000b7b9a98>:0x0000000b7b8440>:
>    () 
> home/stefan/.rvm/gems/ruby-2.0.0-p353/bundler/gems/hobo-9ee13c6ba64e/dryml/lib/dryml/template_environment.rb:647:in
>  
> `method_missing'
>   actionpack (4.0.2) lib/action_view/template.rb:143:in `block in render'
>   activesupport (4.0.2) lib/active_support/notifications.rb:161:in 
> `instrument'

 
I interpret this as the cached partial is not found any more. 
And really, restarting the server and it works again (for the first 
request.)

This also happens for 

> <%= render "recent_conversations" %>

instead of

>  <partial name="recent_conversations" />

So it's not the partial tag itself, that causes this. 

There is a simple workaround here:
I change the view from 

> <div id="recent"><partial name="recent_conversations" /></div>

to not use the partial: 

> <div id="recent"><collection with="&Conversation.recent(5)"/></div>

But I thought it's worth mentioning.

My lesson learned right now would be avoiding partials in DRYML...

Ciao,
Stefan

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to