On 12/18/05, Kevin Clark <[EMAIL PROTECTED]> wrote:
> Hi guys,
> I really like RJS. I think they'll replace partials in alot of
> instances. Unfortunately, because they're automatically used like
> .rhtml and .rxml and are hard to specifically specify it makes it
> messy to preserve fallbacks when using them. For instance, using
> partials instead of rjs, my create method might look like:
>
> def create
>   post = Post.new(params[:post])
>   ...
>
>   if @request.xhr?
>     # render partial
>   else
>     # do other things and let the rhtml be rendered
>   end
> end

My #create/#update actions redirect on regular requests and render rjs
templates on xhr requests.  Therefore, I haven't really ever run into
this particular issue.

One possible solution would be to render an rjs partial.

if request.xhr?
  render :partial => 'create' # _create.rjs
else
  flash[:notice] = 'created.'
  # renders create.rhtml
end

--
rick
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to