On trigger (of an Observer) pop a dialog box (rails)

Go To StackoverFlow.com

0

I implemented an achievements system in my application. Everything works perfectly. I would like to add a feature that creates a pop up (modal dialog box, I am using jquery) when my achievement is triggered. So, I don't really know how do I handle the dialog creation, logically I should put in my observer method (right?), but I don't really know how to start. I would like to have some pointers.

Thank you.

class MyFirstCarObserver < ActiveRecord::Observer
  observe :user_car

  def after_save(user_car)
    MyFirstCar.award_achievements_for(user_car.user)
    # Need to create a dialog box
  end
end
2012-04-04 20:32
by fneron


1

I have similar code where I set a session variable (session[:alert]) and then later in my application layout file I have a line that puts the content of session[:alert], if there is any, into a Javascript dialog box. This kind of code should be in the controller however.

2012-04-04 20:39
by Sprachprofi
Yeah. I understand. I created a generic pop up who handle everything within the "achievement" controller - fneron 2012-05-10 20:22
Ads