Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMS easy does not seem to work with Rails 5.2 #9

Open
imegory opened this issue May 21, 2018 · 8 comments
Open

SMS easy does not seem to work with Rails 5.2 #9

imegory opened this issue May 21, 2018 · 8 comments

Comments

@imegory
Copy link

imegory commented May 21, 2018

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
Copy link
Author

imegory commented May 21, 2018

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.

@jakejcheng
Copy link

Where did you put this?

@chptung
Copy link

chptung commented Jul 3, 2019

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"

@preston
Copy link
Owner

preston commented Jul 3, 2019

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

@preston
Copy link
Owner

preston commented Jul 3, 2019

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

@chptung
Copy link

chptung commented Jul 3, 2019

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

@preston
Copy link
Owner

preston commented Jul 3, 2019

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
Copy link
Owner

preston commented Jul 3, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants