Hi Fred,

You are right about the conditional statement being rubbish.

What I really want is to save users that pass the validations and any
lines in the csv that fail to get skipped over, but remember the error
that was generated.

Without rescue the whole action would fail.

I am just not sure how to record those errors and associate them with
this particular import.

Dan

On 5 Aug, 08:29, Frederick Cheung <[email protected]> wrote:
> On Aug 5, 12:08 am, DanC <[email protected]> wrote:
>
> >           if @user.save!
> >           @user.roles << member_role
> >             else
> >           record_error(line)
> >            end
>
> This else statement will never execute since if save! fails it raises
> an exception. Did you want to use save instead ?
>
> Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to