how does form_for and validate_presence_of work hand in hand

when we have validate_presence_of :name in the model and then when we put in the create action that we re-render 'new', then the form_for will populate the fields, and error_messages_for 'story' will have the correct error message.

this is really great, and and the same time, this looks like magic... i found that many books don't explain how the magic occur. is it by some global variable?

when the form_for is called... is it using the @story that came back from the @story.save, instead of the @story = Story.new from the new action?

sometimes i feel that i am playing magic when using Ruby on Rails, except I don't know how the magic happens... kind of like if I make the rabbit appear, but I don't know how I did it. So I really want to know the inner workings of Rails.

this is really great, and and the same time, this looks like magic... i found that many books don't explain how the magic occur. is it by some global variable?

when the form_for is called... is it using the @story that came back from the @story.save, instead of the @story = Story.new from the new action?

You render the new template, but you don't run the new action again: the @story you display is indeed the one that you tried to save.

Fred