On Sep 29, 10:58 am, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On 29 Sep 2008, at 09:31, FM wrote:
>
> > To do so, I should in some way pass the comment data to the show_by_id
> > action so that the @comment variable can be initialized with these
> > data and presented in the form.
>
> Typically one does that by rendering the edit/create form again rather  
> than redirecting.
>
Thank for your help.
So basically I created a method that fills all the needed variables
and I call it from both the show_by_id and create_comment actions.

However, now I have another question :)
The comment form is located at the end of the page. So basically, when
the user submit a comment, I would like the page to be scrolled down
to the 'comment_form' anchor (i.e., where flashes are currently
displayed)

I tried with this:
form_for(@comment, :url => { :anchor => 'comment_form'})
but doesn't seem to work.

I think that the only solution to this is to put the flash zone at the
beginning of the page, but maybe that there is some technique to get
this behavior*.

Any other idea? :)

Thanks again,
Fabio

* Actually this behavior would be handy to scroll the page to the
inserted comment in order to present it to the user for giving him a
success feedback.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to