I'm creating my first sample Rails application. I have used rufus-scheduler in my application and call controller's action after every 10 sec. My code as follows:
In config/initializers I've created task_scheduler.rb and it contains:
require 'rubygems'
require 'rufus/scheduler'
scheduler = Rufus::Scheduler.new
scheduler.every("10s") do
MyTaskController.doSomething
end
I also created a controller named MyTaskController and code is:
class MyTaskController < ApplicationController
def self.doSomething
puts "some task"
end
end
It works perfectly, but I want to show a popup alert instead of using puts function. Is it possible in rails to call a javascript alert or javascript:window.open from controller (my doSomething action)?