Last active
August 29, 2015 14:13
-
-
Save RubyRonin/3fbb86134f4d045b677f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SenditsController < ApplicationController | |
before_action :set_sendit, only: [:show, :edit, :update, :destroy] | |
def new | |
@sendit = Sendit.new | |
@sendit.alarm = "Even Triggered" | |
@sendit.save | |
respond_to do |format| | |
if @sendit.save | |
# function I am trying to call | |
NotificationController.notify | |
format.html { redirect_to @sendit, notice: 'Sendit was successfully created.' } | |
format.json { render :show, status: :created, location: @sendit } | |
else | |
-----------------error message I am receiving----------------- | |
NoMethodError in SenditsController#new | |
undefined method `notify' for NotificationController:Class | |
------------------NotificationController-------------------- | |
class NotificationController < ApplicationController | |
skip_before_action :verify_authenticity_token | |
def notify | |
client = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token | |
message = client.messages.create from: 'xxxx', to: 'xxxx', body: 'Learning to send SMS you are.' | |
render plain: message.status | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
attempting to send sms utilizing twilio api