views:

14

answers:

1

Hi,

I was looking at some tutorials on rails and found that people use a separate create function for saving form data. When i tried the same i was unable to repopulate the form, that is shown in the index.html.erb and is rendered by the index function. should i add a manual render command?

+1  A: 
  1. Set a member variable (e.g.) @elems to contain data
  2. In your view index.html.erb test for emptiness
  3. If not empty, populate form elements with @elems .
Jas
that isn't too DRY... is it???
Amit
that isn't too DRY... is it??? currently i am doing using if request.post? in the same action... that seems to be more DRY to me...
Amit
instance variables like this one are meant to be shared between the controller and the view.
Jas