Help

I think it’s time for rebooting.

I will watch M. Hartl tutorial again (8th time).
On Wednesday morning i will start again but this time from scratch .

Hi Stepa,

Have you generated active record model? What controller are you using
and how does it look like?

In general,
You have to send a put request to your controller and pass all data you
want to save or you have (depending on behaviour you are trying to
achieve). Then you will be using ActiveRecord to save the data.

Please let us know at what point you are stuck.

On 13 July 2015 at 21:28, StepaAr [email protected]
wrote:

I think it’s time for rebooting.

I will watch M. Hartl tutorial again (8th time).

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

Colin

On 13 July 2015 at 22:47, StepaAr [email protected]
wrote:

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:

[email protected], [email protected], [email protected], [email protected]

he doesn’t save all emails but only first email ([email protected]) 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

https://lh3.googleusercontent.com/-m7BNXNnN4tA/VaQxDLPmrHI/AAAAAAAAABI/mSw75HW79TY/s1600/trial_task.jpg
Of course.It will be 8th time to code he’s twitter again

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

[email protected], [email protected], [email protected], [email protected] 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:

[email protected], [email protected], [email protected], [email protected]

he doesn’t save all emails but only first email ([email protected]) 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs