On 13 July 2015 at 22:47, StepaAr <ser.arsenijevic.mi...@gmail.com> wrote:
>
> Of course.It will be 8th time to code he's twitter again
>
> The problem for me is simple.
> I have this emails:
>
> j...@gmail.com, a...@gmal89.com, ste...@yahoo.com, m...@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:
>
> j...@gmail.com, a...@gmal.com, ste...@yahoo.com, m...@yahoo.com
>
> he doesn't save all emails but only first email (j...@gmail.com) with message 
>  like a flower  in database (i have check this by using index page i.e when i 
> open index page

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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvZWFLi8sFveeSdbvpOw%2BJxh8eAaBwmDm9v8QwFkVAK3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to