I have what I think is a very simple problem. I\'m coming from a PhP background, and used to do this all the time, so I may be looking at this the wrong way.
I am trying
Have a look at http://guides.rubyonrails.org/layouts_and_rendering.html#using-render
You might need render :nothing => true
EDIT: misread your question, render :text => "yourtext"
should fit your needs
In Rails 5 you need to use 'plain':
render plain: params[:email]
You'd need something like this:
def mcsubscribe
# Do something to unsubscribe
respond_to do |format|
format.html { redirect_to(success_page) }
format.js { render :text => params[:email] }
end
end
If ajax is used, the params[:email]
is send as text. If a HTML format is required (ie user clicked a link or filled in a regular form) a redirect is issued to tell the user the subscription has been successful.
Using
print params[:email]
will just print that value to the application logs, not into the response.
You want this:
render :text => params[:email]