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.

- 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.

Hope this helps!

--Matt Jones


--
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