Need a way for Rails controller to return flash messages in response to AJAX request

This post should explain what I’m trying to do.

I have already developed a workaround I’m not entirely pleased with but which I believe with some work and help from the community may be a candidate to become part of Rails if a better solution cannot be found. My road-map for now is to first isolate my solution into it’s own gem and release it. If it receives a positive response, I’ll attempt to integrate it into the Rails project and submit a pull request.

I am an experienced developer but fairly new to Rails (but learning fast!). I have tested this solution in my own application but know that some work and a reliable suite of tests will probably be required before it might be acceptable as a candidate for integration into Rails. Before I go to this effort, I’d like to know a couple things:

  1. The solution contains some Coffescript (Javascript). While Rails has great support for automated testing of models and controllers, I have not been able to find a standard facility for testing Javascript. While I can certainly adapt and use some framework for testing (or develop my own), I would like to use one that is already widely accepted by the Rails community and most importantly by the committers who review submissions. What is the current best practice for testing Javascript as part of Rails?

  2. Are there any guidelines I will need to follow in order for a patch or pull-request to be considered that are not already listed in Contributing to Ruby on Rails — Ruby on Rails Guides. Is this guide up-to-date or is there another document that is more definitive.

  3. Are improvements submitted as pull-requests from my own clone of Rails, or as patch files? (If the latter, please read my use of “pull-request” as “patch”. :slight_smile:

Thank you all! Rails is the best web framework I have ever used and the smartest developers seem to be using Ruby. I want to contribute.

-Larry