Skip to content

Instantly share code, notes, and snippets.

@ohayon
Created November 12, 2012 02:50
Show Gist options
  • Save ohayon/4057238 to your computer and use it in GitHub Desktop.
Save ohayon/4057238 to your computer and use it in GitHub Desktop.
trying to change action of button
def create
@message = Message.new(params[:message])
account_sid = 'AC99a8b8ee9bba15e33ee4cac8bb0e505a'
auth_token = 'f1adcf3b638369e574662fcad40e60f5'
if @message.save
begin
client = Twilio::REST::Client.new account_sid, auth_token
client.account.sms.messages.create(
from: '+16035093259',
to: @message.phone,
body: @message.message
)
render text: "Success!"
rescue Twilio::REST::RequestError
render text: "Try again with a valid number."
end
else
render :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment