Hi there,

I'm a newbie (since 4 weeks) working with hobo.

I have a combined the hobo user model with ancestry gem so users can
build trees of users. Will be a nice feature when everything works
fine :-)

model:
fields do
    email_address :email_address, :unique, :login => true
    administrator :boolean, :default => false
    ancestry      :string, :index => true, :validate => false
    title :string
    firstname  :string
    lastname    :string
....
end

I have simple lifecycle-create-steps

create :signup, :available_to => "Guest",
           :params => [:email_address],
           :become => :active

# Here a user can create a user
create :fillin, :available_to =>  "acting_user if
acting_user.signed_up?",
           :params =>
[:title, :lastname, :firstname,  :email_address],
           :become => :inactive

and several transitions (all working fine) e.g.

transition :choosecompany, { :active => :activeplus }, :available_to
=> "acting_user if acting_user.signed_up?",
    :params => [:usercompany]
------------------
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

  def do_fillin
   do_creator_action :fillin
   @user.parent = current_user
   @user.save
   flash[:notice] = "User saved!"
 end
--------------------
My problem is a find-or-create problem.

If an other user has already created this user (with fillin) and this
new user is trying to signup (with signup) I want to find him and make
him fill missing parts. If his email is not in db I want to create
new.

I need a way to get the email-address in a form and then to decide
wether to start the lifecycle create or a transition OR to break the
lifecycle create, because of validations and not to save the user with
same email again.

I found in all documentation/usergroups/ebooks nearly everything to
solve my existing problems except this here.

Thanks to all. I still work on to find a solution on myself.

Karsten

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