On 6 Apr., 23:55, Matt Jones <[email protected]> wrote:
> On Apr 6, 2010, at 5:22 PM, treemaster wrote:
>
> > ------------------
> > in the controller simple do_lifecycle methods
>
> > # Here is the problem !!!!!
> >  def do_signup
> >   do_creator_action :signup, :redirect => '/'
> >   if thisuser=User.find_by_email_address(@this.email_address)
> >     @this=thisuser
> >   end
> >   flash[:notice] = "Success!"
> > end
>
> Couple notes here:
>
> - don't use @this. It's an implementation detail, in the same category  
> as the Rails instance vars (like @request) that were deprecated a  
> number of releases back. Just like the Rails methods, always use the  
> method form (this, or self.this) over the @ form.

-> Thanks.

>
> - do_creator_action takes a block. The version you've got here will  
> either not work the way you expect, or perhaps give you a  
> DoubleRenderError.
>
> Here's one way to accomplish sort of what you're looking for; the  
> details aren't entirely clear from your post:
>
> def do_signup
>   �...@user = User.find_by_email_address(params[:user][:email_address])
>    if @user
>      redirect_to someplace_else_path
>    else
>      do_creator_action :signup, :redirect => '/' do
>        flash[:notice] = 'Success!'
>      end
>    end
> end
>
> It might make sense to handle the "incoming user with email in the  
> system already" case by sending a confirmation mail to that email, to  
> prevent nefarious characters claiming emails that aren't theirs.

-> That was even a great idea and I used it for my next transition !

>
> Hope this helps!
>
> --Matt Jones

@Matt: big thanks for that Solution! It was exact what I was looking
for !

@Kevin: I thought several times about your solution before and at the
end I decided to walk the hard way through the user model to avoid
storing the email twice. I'm a litte bit under time pressure to solve
this project and maybe I'm blind to see the right way.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to