HELP

Don't just watch it, work right through it, entering all the code, getting it working and doing the exercises.

Colin

Of course.It will be 8th time to code he’s twitter again

The problem for me is simple. I have this emails:

john@gmail.com, alex@gmal89.com, stev89@yahoo.com, mike@yahoo.com and the all have some message (example): like a flower

The second email is invalid and i have made that working typing in create controller condition for saving data Like this:

def create if @invations.save && @invitations.check_for_valid_emails #bla bla

this provided that i cant save wrong emails but when i correct email like this:

john@gmail.com, alex@gmal.com, stev89@yahoo.com, mike@yahoo.com

he doesn’t save all emails but only first email (john@gmail.com) with message like a flower in database (i have check this by using index page i.e when i open index page i can see only message for first email)

while i should seen for all my email saved massage.

MY QUESTION IS:

How can i save for every (working) email (separated) in database with the same message? Now i’m saving only for first email.

Conclude: I have to save every valid email in database separated with message

This is layout (picture how it should look) is at the beginning of this replay

I need to finish this task by Thursday

You say you have the emails shown, but have not said in what way you 'have' them. Are they encoded into a single string or in separate fields from a form or what? If you look in log/development.log you will see the parameters that are passed in to your action. Copy and paste here the section from the log file that shows the create action. Also you have not explained how you wish them saved. Are they in separate records or somehow encoded into a single record?

In your create method you show it saving @invations then checking a different variable @invitations. Always copy/paste code here rather than re-typing otherwise we do not know whether the errors we see are just typos in the email. You do not seem to have set @invitations to any value, and also you are checking for valid emails only after you save it. Is that correct? Normally data validity checks would be done in validations so that the save only happens if the data are valid.

Colin