app/controllers/api/people_controller.rb
# Create a new person by params and current community
Create a new person by params and current community
Create a new person by params and current community
def new_person(params, current_community)
    person = Person.new
    params[:person][:locale] =  params[:locale] || APP_CONFIG.default_locale
    params[:person][:test_group_number] = 1 + rand(4)
    email = Email.new(:person => person, :address => params[:person][:email].downcase, :send_notifications => true)
    params["person"].delete(:email)
    person = build_devise_resource_from_person(params[:person])
    person.emails << email
    person.inherit_settings_from(current_community)
    if person.save!
      sign_in(resource_name, resource)
    end
    person.set_default_preferences
    [person, email]
    respond_to do |format|
      format.xml { render :xml => @person }
      format.json { render :json => @person }
    end
  end
def new_person ( params , current_community ) person = Person . new params [ :person ] [ :locale ] = params [ :locale ] || APP_CONFIG . default_locale params [ :person ] [ :test_group_number ] = 1 + rand ( 4 ) email = Email . new ( :person => person , :address => params [ :person ] [ :email ] . downcase , :send_notifications => true ) params [ "person" ] . delete ( :email ) person = build_devise_resource_from_person ( params [ :person ] ) person . emails << email person . inherit_settings_from ( current_community ) if person . save! sign_in ( resource_name , resource ) end person . set_default_preferences [ person , email ] respond_to do | format | format . xml { render :xml => @person } format . json { render :json => @person } end end
Create a new person by params and current community
Create a new person by params and current community
params
current_community