Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a javascript function that shows a login pane above what's currently on the page. I know that in my controllers I can do:

respond_to do |format|
  format.html
  format.js 
end

But I want to be able to trigger Javascript from my sessions_helpers' method signed_in_user which is placed throughout my controllers as:

:before_filter signed_in_user

def signed_in_user
 unless signed_in?
  store_location
  redirect_to signin_path, notice: "Please sign in."
 end
end

Essentially I would only need to call

return false;  //stop the redirect
$('#loginwindow').fadeIn(); or $('#loginwindow').show()

Which would allow me to deal with users who both have and don't have javascript, But is there anyway to fire javascript like this from a helper?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.