estum / growlyflash

Growl-styled flash messages for Ruby on Rails and Bootstrap
MIT License
58 stars 34 forks source link

XHR notices don't work where as non XHR does #30

Closed atinder closed 8 years ago

atinder commented 8 years ago

I have installed and setup the gem as shown in readme. Normal notices or shown but when something done with ajax, no notice is shown. I added use_growlyflash in application controller. Am i missing any configuration ?

estum commented 8 years ago

@atinder90, please, check a XHR response for the X-Message header and, also, check handlers on ajax:complete ajaxComplete events (just add another one handler to see if it fires). You can also set Growlyflash.debug = true; in the browser console and see some debug messages.

atinder commented 8 years ago

thanks for replying so fast. ye X-Message was not set per api because i was trying to to it like this

format.json { render :show, status: :ok, location: @playlist, notice: 'Playlist was successfully updated.' }

fixed it by using following code.


flash[:notice] = "Playlist was successfully updated."
format.json { render :show, status: :ok, location: @playlist }