# Will the controller compiles the rjs only on ajax request?

**URL:** <https://www.ruby-forum.com/t/will-the-controller-compiles-the-rjs-only-on-ajax-request/166691>\
**Category:** Rails\
**Created:** [April 28, 2009, 4:29pm UTC](https://www.ruby-forum.com/t/will-the-controller-compiles-the-rjs-only-on-ajax-request/166691 "2009-04-28T16:29:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSZSmSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b3f665/32.png) [@SSZSmSS](https://www.ruby-forum.com/u/SSZSmSS)\
**Post date:** [April 28, 2009, 4:29pm UTC](https://www.ruby-forum.com/t/will-the-controller-compiles-the-rjs-only-on-ajax-request/166691/1 "2009-04-28T16:29:57Z")

</div>

will the controller compiles the rjs only on ajax request ?

class xyzController \< …  
def ajax\_req  
““This works fine “”  
“”“ajax\_req.rjs is not compiled”””  
end  
def non\_ajax\_req  
“”" non\_ajax\_req.rjs is not compiled"""  
end  
end

Am i right or my code lacks something ?
