sms-easy icon indicating copy to clipboard operation
sms-easy copied to clipboard

SMS easy does not seem to work with Rails 5.2

Open imegory opened this issue 6 years ago • 8 comments

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?

imegory avatar May 21 '18 22:05 imegory

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.

imegory avatar May 21 '18 23:05 imegory

Where did you put this?

jakejcheng avatar Jun 30 '19 07:06 jakejcheng

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 avatar Jul 03 '19 16:07 chptung

@chptung I can put out a patch real quick if you want to submit a PR?

preston avatar Jul 03 '19 16:07 preston

@chptung Any idea when Rails removed the render :text support? (I have to update the gemspec for the patched release.)

preston avatar Jul 03 '19 17:07 preston

Unfortunately, I'm not sure, but @imegory might know.

chptung avatar Jul 03 '19 17:07 chptung

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..

preston avatar Jul 03 '19 17:07 preston

@chptung @imegory I just pushed a 1.4.0 build and updated the docs. Give it a shot? Commit: 75248bc5bd3a67e0b23b0ab357e94929988051a8

preston avatar Jul 03 '19 17:07 preston