Ruby on Rails Sunday, August 1, 2010

On 1 Aug, 23:42, Neil Bye <li...@ruby-forum.com> wrote:
> Neil Bye wrote:
>
> >> Is there anything unusual in the view that triggers this?
>
> >> Fred
>
> > This is the problem line from the view:
> >   <% remote_form_for :comment, :url=>story_comments_path(@story), :html
> > => { :id => 'comment' } do |form| %>

That's why your redirect doesn't work - the redirect just redirects
the request made by the JavaScript (rjs has a page.redirect_to thing
that will produce the JavaScript required to point the browser window
at a new location. If you are going to do a full page refresh though,
what's the point of using Ajax?)

Fred

> >        <div id="body"><%= form.text_field :body %></div>
> >        <p><%= submit_tag  'Comment' %></p>
>
> However if I leave the remote_ in and change the create function to
>
>  def create
>     @story = Story.find(params[:story_id])
>     @story.comments.create params[:comment]
>     respond_to do |format|
>     format.js
>     end
>   end
>
> It responds with
>
> Missing template comments/create.erb in view path app/views
>
> Why wont it find create.rjs?
>
> --
> 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@googlegroups.com.
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.

No comments:

Post a Comment