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.
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.
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?
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?
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.
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.
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.