I’ve been searching for this for days, but I can’t seem to find an
I’m creating a blog in Rails 2.0.2, and for comments, I’m using a
nested resource, my CommentsController, inside my PostsController.
When a user submits a comment to a post, and fills out the form
properly, I use a redirect_to and throw in an anchor tag to drop them
down to their newly posted comment. Great! However, if a user does not
fill out the form properly, the form puts out errors inline on the
page. Also great.
However, I can’t seem to skip users down to the errors in the comment
box using an anchor tag.
The problem is, I’m using render :action => “new” in my create action
(if errors occur), so that error messages can be maintained, but
obviously, render :action => “new”, :anchor => “comments_form” doesn’t
work. I’m fine with using redirect_to in order to gain the ability to
append the anchor text to the url, but I can’t figure out how to
maintain errors and get all the nice form highlighting and error
messages this way.
at all possible. Besides, shouldn’t there be a way to do this
Thanks for your help!