codeforamerica/textizen

New phone numbers fail to provision on staging

Closed this issue · 1 comments

from https://github.com/codeforamerica/textizen/blob/dev/app/models/poll.rb

before_create :set_new_phone_number

  def set_new_phone_number
    puts 'set new phone number'
    self.phone = self.phone || get_phone_number
  end

should be called but is not logging anything,
All I see is "Phone Number already taken"

2012-07-30T00:35:13+00:00 app[web.1]: Started POST "/polls" for 98.210.166.180 at 2012-07-30 00:35:13 +0000
2012-07-30T00:35:13+00:00 app[web.1]: Phone has already been taken
2012-07-30T00:35:13+00:00 app[web.1]: Processing by PollsController#create as HTML
2012-07-30T00:35:13+00:00 app[web.1]:   Parameters: 
{"utf8"=>"✓", "authenticity_token"=>"oM06MUvZTmbV4wMbXQUkGA3qH2q9jEqjVF6B2qA5jcA=", 
"poll"=>{"questions_attributes"=>{"1343608498467"=>{"_destroy"=>"", "sequence"=>"", "text"=>"test", "question_type"=>"OPEN"}}, 
"confirmation"=>"", "title"=>"test poll", "start_date(1i)"=>"2012", "start_date(2i)"=>"7", "start_date(3i)"=>"29", "start_date(4i)"=>"20", "start_date(5i)"=>"34", "end_date(2i)"=>"9", "end_date(3i)"=>"29", "end_date(1i)"=>"2012", "group_ids"=>"2"}, "commit"=>"Create Poll"}

vs. the currently working code from master on production

Started GET "/assets/favicon.ico" for 127.0.0.1 at 2012-07-29 16:59:11 -0700
Served asset /favicon.ico - 304 Not Modified (0ms)
set new phone number
get phone number
112153846244


Started POST "/polls" for 127.0.0.1 at 2012-07-29 16:59:22 -0700
Processing by PollsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"DREnJSIVJ9WJ3dB8n/yGESobCpJQg2Q3siqdS8cANco=", "poll"=>{"questions_attributes"=>{"1343606351209"=>{"_destroy"=>"", "sequence"=>"", "text"=>"test", "question_type"=>"OPEN"}}, "confirmation"=>"", "title"=>"", "start_date(1i)"=>"2012", "start_date(2i)"=>"7", "start_date(3i)"=>"29", "start_date(4i)"=>"19", "start_date(5i)"=>"59", "end_date(2i)"=>"8", "end_date(3i)"=>"29", "end_date(1i)"=>"2012", "group_ids"=>"1"}, "commit"=>"Create Poll"}

Also, just to be sure, I tried manually running Poll#get_phone_number and that worked fine (the bit that actually gets the number from Tropo)

irb(main):003:0> Poll.last.get_phone_number
  Poll Load (1.4ms)  SELECT "polls".* FROM "polls" ORDER BY "polls"."id" DESC LIMIT 1
get phone number
  Group Load (4.4ms)  SELECT "groups".* FROM "groups" INNER JOIN "groups_polls" ON "groups"."id" = "groups_polls"."group_id" WHERE "groups_polls"."poll_id" = 8
=> "1440202931#"