I have a custom format that I''m using called
''desktop''.
I have an action which is called via AJAX, and I''d like to update a div
in my page with a partial.
The request comes in with params[:format] == ''desktop'', and my
partial
is named _search_results.desktop.erb
However, when I do this in my action:
respond_to do |format|
format.desktop {render :update do |page|
page.replace_html(''search_results'',
:partial =>
''search_results'')
end}
end
I keep getting errors about missing _search_results.html.erb.
Can you not use a custom format with the render :update do |page| idiom?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I think I remember an issue that when using custom formats you need to give the full path the the partial like :partial => ''posts/ search_results''. Bradly Feeley On Apr 18, 6:01 pm, Wes Gamble <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have a custom format that I''m using called ''desktop''. > > I have an action which is called via AJAX, and I''d like to update a div > in my page with a partial. > > The request comes in with params[:format] == ''desktop'', and my partial > is named _search_results.desktop.erb > > However, when I do this in my action: > > respond_to do |format| > format.desktop {render :update do |page| > page.replace_html(''search_results'', :partial => > ''search_results'') > end} > end > > I keep getting errors about missing _search_results.html.erb. > > Can you not use a custom format with the render :update do |page| idiom? > > Thanks, > Wes > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bradly Feeley wrote:> I think I remember an issue that when using custom formats you need to > give the full path the the partial like :partial => ''posts/ > search_results''. > > Bradly Feeley > > > On Apr 18, 6:01�pm, Wes Gamble <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>That doesn''t seem to work for me. W -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dmitry.sokurenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Apr-21 13:12 UTC
Re: Does respond_to play nicely with render :update?
Try to include the extension -- :partial => ''posts/ search_results.desktop.erb''. Dmitry
If I do this, it works:
page.replace_html(''search_results'', render(:partial =>
''search_results''))
Notice that originally, I was passing just the hash key/value pair, but
now I am passing a render call.
According to the API docs:
"options_for_render may be either a string of HTML to insert, or a hash
of options to be passed to ActionView::Base#render."
which is what I was doing that wasn''t working. I wonder if what
happens
when I pass the render call, is that returns a string that is used in
the replace_html call.
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.