Help filling out a registration (I think it's called multi tenant)

Do you know when you are filling out a registration for a new account, and you keep pressing next to fill the rest of the information in separate pages?

I’d like to do that, but I have no idea how.

Basically I have a company model with its information, and a contacts model, with belongs to my company (also each company has only one contact), and I’d like for the user to fill in the company specific information (like email, name, address, etc), and click next down the page to fill in the contact information (telephone, manager email, etc). Also I’d like to save it to the database only if all the information in both pages are inputed.

Thank you,

Rodrigo

Hi Rodrigo,

Take a look at this screencast, from Ryan Bates: http://railscasts.com/episodes/217-multistep-forms

Best Regards,

Everaldo

And just FYI, multi-tenant usually means that you have one database containing separate (unrelated) client accounts, for example Basecamp. There isn't a separate database for my Basecamp account and yours, our records are all commingled in one set of tables, and the server enforces business rules to make sure I don't see your messages and vice-versa.

Walter

thank you

Thank you very much, I’m watching the video right now, but I think this is exactly what I was looking for

I watched the screencast, and it covers the multi step form thing but with only one model. I'd like to the the same thing but each step would be a different model. How can I do that?

1 page, 1 form, 1 model -- sounds typical; what's the problem?

Problem is I want more than one model as I explained before.

So each "step" is a different page, different model -- again, what is the issue? Complete one, go to the next.

Take a look in these screencasts:

http://railscasts.com/episodes?utf8=%E2%9C%93&search=model

http://railscasts.com/episodes/196-nested-model-form-part-1

http://railscasts.com/episodes/197-nested-model-form-part-2

Maybe they can help you.

Best regards,

Everaldo

Hi All,

When I enter a Start Date in the text field as "07/11/2011" it gets stored in the database as "2011-11-07" instead of "2011-07-11".

This change happens before the column is available in the controller. Is there some Rails setting that will make this happen magically or do I have to have some fun with date parsing?

Thanks!

**Leigh

I want to save all together, not step by step. Or all saves, or none of them goes to the database

It uses a method called ‘build’, which says (to me at least) that it doesn’t exist.

your input format is DD/MM/YYYY. change this to MM/DD/YYYY.

Or better yet, "11 July 2011" - this makes it unambiguous. If you're expecting users to type in dates in a certain format without making mistakes, you're setting yourself up for lots of problems.

I'd also suggest using a date-select JS plugin to make it very easy for your users to select the right date.

Hi All,

When I enter a Start Date in the text field as "07/11/2011" it gets stored in the database as "2011-11-07" instead of "2011-07-11".

This change happens before the column is available in the controller. Is there some Rails setting that will make this happen magically or do I have to have some fun with date parsing?

If you want to allow the user to enter dates like this you will have to parse it yourself to make sure the month and day are as you want them. If the site is for an international audience I suggest you use separate fields for the three components as otherwise you will have no end of trouble as most of the world uses day/month/year. I don't understand what you mean by "it happens before the column is available in the controller". The field will be passed as a string from the form to the controller and should appear in params exactly as entered by the user. Note also that, since you have specified a date field in the database, what is stored there is not "2011-07-11" or any other string, but is the date itself.

Colin

Do you mean the user should type it in as MM/DD/YYYY or that there is a setting somewhere that I should change?

**Leigh

Hi Leigh, It seems it takes the input as DD/MM/YYYY by default. that you need to change to your convenient format. Or ask the user to input the date in DD/MM/YYYY format which is default/current.

I don’t know if this is because Ryan Bates used nifty-generators to scaffold…

Try to follow the tutorial step by step, or download the source code of the episode.

Best Regards,

Everaldo

It uses a method called 'build', which says (to me at least) that it doesn't exist.

Show us the exact error and the code around the failing line.

Colin