Permalink
Browse files

- fix issue

  • Loading branch information...
1 parent f4c5098 commit a37bc2eb8ac5049029afedb1fef1519a8e4c3bcc @sr3d committed Jan 29, 2012
Showing with 14 additions and 3 deletions.
  1. +1 −0 app/controllers/twilio_callback_controller.rb
  2. +13 −3 app/models/user.rb
@@ -2,6 +2,7 @@ class TwilioCallbackController < ApplicationController
before_filter :find_user
def index
+
respond_to do |format|
format.xml do
digits = params[:Digits]
View
@@ -45,12 +45,22 @@ def get_demo_user
end
- def find_by_phone(phone)
+ def find_or_create_by_phone(phone)
if user = User.find_by_phone(phone)
return user
+ else
+ name = [
+ "John",
+ "Paul",
+ "Sam",
+ "Will",
+ "Robert",
+ "Quinnie",
+ "Ben",
+ ].sample
+ user = User.create "email.#{name}.#{Time.now}@marrily.com", :password => '123456', :password_confirmation => '123456', :first_name => name, :phone => phone
+ user
end
- # user = User.new :phone => phone
- get_demo_user
end
end

0 comments on commit a37bc2e

Please sign in to comment.