Im hoping there is a cleaning way of getting flash messages to work in an ajax call using React. Been looking on the web and, honestly, Im sure it can be done without much added code.
def my_method
[...]
flash[:success] = "Yea bouy."
if request.xhr?
render :json => {
:order => true,
}
end
end
I'm not doing a page redirect and was wondering how to get a simple flash to show. Anwers around showing adding more methods. Could I have the flash code within my method? Something like:
def my_method
[...]
if request.xhr?
render :json => {
:order => true,
}
end
return flash[:success] = "Yea bouy." # Only works when page refreshes.
end