Permalink
Browse files

refactoring remove assigned voice number for campaign

  • Loading branch information...
1 parent ab6dbf6 commit 804e73f265405a1cc35c6092885e03eeedd96b1a Willa committed Nov 13, 2012
Showing with 2 additions and 3 deletions.
  1. +1 −1 lib/crowdring/crowdring.rb
  2. +1 −2 lib/views/voice_numbers.haml
View
2 lib/crowdring/crowdring.rb
@@ -333,7 +333,7 @@ def process_request(service_name, request, response_type)
post '/campaign/:id/assigned_voice_number/destroy' do
campaign = Campaign.get(params[:id])
unless campaign.voice_numbers.count == 1
- campaign.voice_numbers.get(params[:voice_number]).destroy
+ campaign.voice_numbers.first(id: params[:number_id]).destroy
flash[:notice] = "Voice number has been removed"
redirect to("/campaigns##{campaign.id}")
else
View
3 lib/views/voice_numbers.haml
@@ -7,6 +7,5 @@
-voice_numbers.each do |voice_number|
%h4= "Phone Number: #{voice_number.pretty_phone_number}, Description: #{voice_number.description}"
%form{action: "/campaign/#{campaign.id}/assigned_voice_number/destroy", method: 'post'}
- %input{type: 'hidden', name: 'phone_nubmer', value: "#{voice_number.phone_number}"}
- %input{type: 'hidden', name: 'voice_number[id]', value: "#{voice_number.id}"}
+ %input{type: 'hidden', name: 'number_id', value: "#{voice_number.id}"}
%button{type: 'submit'} Remove

0 comments on commit 804e73f

Please sign in to comment.