sms-easy
sms-easy copied to clipboard
SMS easy does not seem to work with Rails 5.2
I have upgraded rails from 5.0 to 5.2. It appears that SMS-easy fails because rails is looking for a view that does not exist. I added the view just to test what will happen. And then SMS easy was actually trying to send a file.
Can someone please test on Rails 5.2? If not, please let me know how to contribute to this project. Should I create a PR?
Well, the fix is pretty easy. Rails (I believe) 5.1 removed "render :text". To make sms-easy work with my Rails 5.2, needed to change SMSEasyNotifier as follows (the new code that works with Rails 5.2):
class SMSEasyNotifier < ActionMailer::Base
def send_sms(recipient, message, sender_email)
mail(:to => recipient, :from => sender_email, :subject => '') do |format|
format.text { render :plain => message, :layout => false }
format.html { render :plain => message, :layout => false }
end
end
end
Am not sure why format.html is in this code because we are sending plain text in SMS. Anyways, the changes are the render text to render plain and adding the layout => false.
Where did you put this?
I was struggling with this too but realized that the way to fix it was by making a PR and updating the code to what @imegory said.
Since I'm not sure this project is still maintained, you can use my forked gem to get it to work:
gem "sms-easy", :git => "https://github.com/chptung/sms-easy-shoppy-sms.git"
@chptung I can put out a patch real quick if you want to submit a PR?
@chptung Any idea when Rails removed the render :text
support? (I have to update the gemspec for the patched release.)
Unfortunately, I'm not sure, but @imegory might know.
Ok, I'm not super worried about it as the older version should still work for folks not on 5.2 yet. Prepping 1.4.0 now..
@chptung @imegory I just pushed a 1.4.0 build and updated the docs. Give it a shot? Commit: 75248bc5bd3a67e0b23b0ab357e94929988051a8