Day 51 : Quick updates

To create a Save as draft for an application form, we did this :

1. Created a Save option in the form and set the value to ‘draft’.

2. Migration to add a column called status to application model.

3. In create method of controller we have this logic to check if we want to save as a draft : if params[:commit] == ‘Save’. If yes, then set the application status value to ‘draft’. Coming to why we have to do this. ( Commit is the name attribute of the submit button )

4. So. Next. When we want to view the half completed form, we need to make sure that we’re showing the right thing. So, in the show method of controller, we’re checking the value of the status column. If it is a draft, render the appropriate form.

But no, this isn’t working. The form is simply not getting saved as a draft. It’s just getting published. I’m probably missing something.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s